[Mlir-commits] [mlir] [mlir][spirv] Add bfloat16 support (PR #141458)

Jakub Kuderski llvmlistbot at llvm.org
Thu Jun 5 07:24:40 PDT 2025


================
@@ -514,6 +514,12 @@ bool ScalarType::isValid(IntegerType type) {
 
 void ScalarType::getExtensions(SPIRVType::ExtensionArrayRefVector &extensions,
                                std::optional<StorageClass> storage) {
+  if (llvm::isa<BFloat16Type>(*this)) {
+    static const Extension exts[] = {Extension::SPV_KHR_bfloat16};
+    ArrayRef<Extension> ref(exts, std::size(exts));
+    extensions.push_back(ref);
----------------
kuhar wrote:

```suggestion
    static const auto ext = Extension::SPV_KHR_bfloat16;
    extensions.push_back(ext);
```
ArrayRef has a constructor that takes a single element

https://github.com/llvm/llvm-project/pull/141458


More information about the Mlir-commits mailing list