I built MLIR by following the original instructions and I followed the toy tutorial to learn the basics. I tried adding the Tensor and Linalg dialects to the context registry in the toy tutorial repo in order to use the toy-opt tool to lower code such as
func.func @main() {
%static_tensor = tensor.empty() : tensor<4x8xf32>
return
}
to test whether the tensor dialect and linalg were available but I always get errors such as:
loc("./test/Engine/tensorLinalg.mlir":11:35): error: expected ':'
Error can't load file ./test/Engine/tensorLinalg.mlir
lli: Symbols not found: [ main ]
So I tried using the mlir-opt on the mlir repo inside llvm-project but it seems that the dialects listed on the mlir page (https://mlir.llvm.org/docs/Dialects/) don’t come registered by default:
test_llvm.mlir:3:10: error: Dialect `tensor' not found for custom op 'tensor.empty'
%0 = tensor.empty() : tensor<4x8xf32>
^
test_llvm.mlir:3:10: note: Registered dialects: acc, amx, arm_neon, arm_sme, arm_sve, builtin, dlti, func, gpu, llvm, nvvm, omp, rocdl, spirv, vcix, x86vector ; for more info on dialect registration see https://mlir.llvm.org/getting_started/Faq/#registered-loaded-dependent-whats-up-with-dialects-management
I only wish to use arith, memref, linalg and tensor dialects of which arith and memref I can already use and lower to llvm. Is there some available project that can help me with the boilerplate? Any help would be greatly appreciated.