iree-org / iree

A retargetable MLIR-based machine learning compiler and runtime toolkit.
http://iree.dev/
Apache License 2.0
2.47k stars 551 forks source link

Build fails due to "LLVM ERROR: can't create Attribute 'mlir::iree_compiler::IREE::GPU::ComputeBitwidthsAttr' because storage uniquer isn't initialized: the dialect was likely not loaded, or the attribute wasn't added with addAttributes<...>() in the Dialect::initialize() method." #17736

Closed andfau-amd closed 5 days ago

andfau-amd commented 6 days ago

What happened?

[7144/7342] Generating check_failure_v...ure.mlir_module.vmfb from failure.mlir
FAILED: runtime/src/iree/modules/check/test/check_failure_vulkan-spirv_vulkan_failure.mlir_module.vmfb /home/anfaulds/Projects/IREE/iree-build/runtime/src/iree/modules/check/test/check_failure_vulkan-spirv_vulkan_failure.mlir_module.vmfb
cd /home/anfaulds/Projects/IREE/iree-build/runtime/src/iree/modules/check/test && /home/anfaulds/Projects/IREE/iree-build/tools/iree-compile --output-format=vm-bytecode --mlir-print-op-on-diagnostic=false --iree-hal-target-backends=vulkan-spirv /home/anfaulds/Projects/IREE/iree/runtime/src/iree/modules/check/test/failure.mlir -o check_failure_vulkan-spirv_vulkan_failure.mlir_module.vmfb --iree-hal-executable-object-search-path=\"/home/anfaulds/Projects/IREE/iree-build\"
LLVM ERROR: can't create Attribute 'mlir::iree_compiler::IREE::GPU::ComputeBitwidthsAttr' because storage uniquer isn't initialized: the dialect was likely not loaded, or the attribute wasn't added with addAttributes<...>() in the Dialect::initialize() method.
Please report issues to https://github.com/iree-org/iree/issues and include the crash backtrace.
Stack dump:
0.      Program arguments: /home/anfaulds/Projects/IREE/iree-build/tools/iree-compile --output-format=vm-bytecode --mlir-print-op-on-diagnostic=false --iree-hal-target-backends=vulkan-spirv /home/anfaulds/Projects/IREE/iree/runtime/src/iree/modules/check/test/failure.mlir -o check_failure_vulkan-spirv_vulkan_failure.mlir_module.vmfb --iree-hal-executable-object-search-path=\"/home/anfaulds/Projects/IREE/iree-build\"
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
0  libIREECompiler.so 0x00007fb99241bc27 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 39
1  libIREECompiler.so 0x00007fb992419e50 llvm::sys::RunSignalHandlers() + 80
2  libIREECompiler.so 0x00007fb99241c2ea
3  libc.so.6          0x00007fb98d1de520
4  libc.so.6          0x00007fb98d2329fc pthread_kill + 300
5  libc.so.6          0x00007fb98d1de476 raise + 22
6  libc.so.6          0x00007fb98d1c47f3 abort + 211
7  libIREECompiler.so 0x00007fb99239d4cc llvm::report_fatal_error(llvm::Twine const&, bool) + 460
8  libIREECompiler.so 0x00007fb994a6324f
9  libIREECompiler.so 0x00007fb994a4f6e0
10 libIREECompiler.so 0x00007fb994a4c336
11 libIREECompiler.so 0x00007fb994a4d65a
12 libIREECompiler.so 0x00007fb99368af31
13 libIREECompiler.so 0x00007fb993688d07
14 libIREECompiler.so 0x00007fb993688b48
15 libIREECompiler.so 0x00007fb99388ecef
16 libIREECompiler.so 0x00007fb9925bdd85 mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) + 629
17 libIREECompiler.so 0x00007fb9925be508 mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) + 328
18 libIREECompiler.so 0x00007fb9925c0939 mlir::PassManager::run(mlir::Operation*) + 985
19 libIREECompiler.so 0x00007fb992372230 ireeCompilerInvocationPipeline + 3408
20 libIREECompiler.so 0x00007fb9925843f8
21 libIREECompiler.so 0x00007fb992583c81
22 libc.so.6          0x00007fb98d1c5d90
23 libc.so.6          0x00007fb98d1c5e40 __libc_start_main + 128
24 iree-compile       0x0000560e5a86e6c5
Aborted
[7151/7342] Generating check_vulkan-sp...ess.mlir_module.vmfb from success.mlir
FAILED: runtime/src/iree/modules/check/test/check_vulkan-spirv_vulkan_success.mlir_module.vmfb /home/anfaulds/Projects/IREE/iree-build/runtime/src/iree/modules/check/test/check_vulkan-spirv_vulkan_success.mlir_module.vmfb
cd /home/anfaulds/Projects/IREE/iree-build/runtime/src/iree/modules/check/test && /home/anfaulds/Projects/IREE/iree-build/tools/iree-compile --output-format=vm-bytecode --mlir-print-op-on-diagnostic=false --iree-hal-target-backends=vulkan-spirv /home/anfaulds/Projects/IREE/iree/runtime/src/iree/modules/check/test/success.mlir -o check_vulkan-spirv_vulkan_success.mlir_module.vmfb --iree-hal-executable-object-search-path=\"/home/anfaulds/Projects/IREE/iree-build\"
LLVM ERROR: can't create Attribute 'mlir::iree_compiler::IREE::GPU::ComputeBitwidthsAttr' because storage uniquer isn't initialized: the dialect was likely not loaded, or the attribute wasn't added with addAttributes<...>() in the Dialect::initialize() method.
Please report issues to https://github.com/iree-org/iree/issues and include the crash backtrace.
Stack dump:
0.      Program arguments: /home/anfaulds/Projects/IREE/iree-build/tools/iree-compile --output-format=vm-bytecode --mlir-print-op-on-diagnostic=false --iree-hal-target-backends=vulkan-spirv /home/anfaulds/Projects/IREE/iree/runtime/src/iree/modules/check/test/success.mlir -o check_vulkan-spirv_vulkan_success.mlir_module.vmfb --iree-hal-executable-object-search-path=\"/home/anfaulds/Projects/IREE/iree-build\"
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
0  libIREECompiler.so 0x00007effd219bc27 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 39
1  libIREECompiler.so 0x00007effd2199e50 llvm::sys::RunSignalHandlers() + 80
2  libIREECompiler.so 0x00007effd219c2ea
3  libc.so.6          0x00007effccf5e520
4  libc.so.6          0x00007effccfb29fc pthread_kill + 300
5  libc.so.6          0x00007effccf5e476 raise + 22
6  libc.so.6          0x00007effccf447f3 abort + 211
7  libIREECompiler.so 0x00007effd211d4cc llvm::report_fatal_error(llvm::Twine const&, bool) + 460
8  libIREECompiler.so 0x00007effd47e324f
9  libIREECompiler.so 0x00007effd47cf6e0
10 libIREECompiler.so 0x00007effd47cc336
11 libIREECompiler.so 0x00007effd47cd65a
12 libIREECompiler.so 0x00007effd340af31
13 libIREECompiler.so 0x00007effd3408d07
14 libIREECompiler.so 0x00007effd3408b48
15 libIREECompiler.so 0x00007effd360ecef
16 libIREECompiler.so 0x00007effd233dd85 mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) + 629
17 libIREECompiler.so 0x00007effd233e508 mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) + 328
18 libIREECompiler.so 0x00007effd2340939 mlir::PassManager::run(mlir::Operation*) + 985
19 libIREECompiler.so 0x00007effd20f2230 ireeCompilerInvocationPipeline + 3408
20 libIREECompiler.so 0x00007effd23043f8
21 libIREECompiler.so 0x00007effd2303c81
22 libc.so.6          0x00007effccf45d90
23 libc.so.6          0x00007effccf45e40 __libc_start_main + 128
24 iree-compile       0x00005625cf4f36c5
Aborted
[7161/7342] Generating check_llvm-cpu_...ess.mlir_module.vmfb from success.mlir
ninja: build stopped: subcommand failed.

Steps to reproduce your issue

$ cmake -G Ninja -B ../iree-build/ -S . -DCMAKE_BUILD_TYPE=RelWithDebInfo -DIREE_ENABLE_ASSERTIONS=ON -DIREE_ENABLE_SPLIT_DWARF=ON -DIREE_ENABLE_THIN_ARCHIVES=ON -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DIREE_ENABLE_LLD=ON -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DIREE_TARGET_BACKEND_DEFAULTS=OFF -DIREE_TARGET_BACKEND_LLVM_CPU=ON -DIREE_HAL_DRIVER_DEFAULTS=OFF -DIREE_HAL_DRIVER_LOCAL_SYNC=ON -DIREE_HAL_DRIVER_LOCAL_TASK=ON -DIREE_BUILD_PYTHON_BINDINGS=ON -DPython3_EXECUTABLE="$(which python)" -DIREE_TARGET_BACKEND_VULKAN_SPIRV=ON
$ cmake --build ../iree-build/

Ubuntu 22.04.4 LTS (WSL2, Windows 11)

This is a fresh build, but CCache is in use, so it's not impossible that something in the cache is stale?

What component(s) does this issue relate to?

No response

Version information

$ git log -1
commit 1f69b857fffb2367682b436684cd9868329cd109 (HEAD -> main, tag: candidate-20240625.935, origin/main, origin/latest-snapshot, origin/HEAD)
Author: Max191 <44243577+Max191@users.noreply.github.com>
Date:   Mon Jun 24 18:50:57 2024 -0400

    [LinalgExt] Add iree_linalg_ext.im2col op and verifier (#17644)

    This PR adds a new iree_linalg_ext.im2col op representing the im2col
    transformation for convolutions. The PR contains the op definition and
    the verifier.

    ---------

    Signed-off-by: Max Dawkins <max.dawkins@gmail.com>

Additional context

No response

andfau-amd commented 6 days ago

Preliminary analysis suggests the iree_gpu dialect isn't getting registered prior to this attribute being used.

andfau-amd commented 5 days ago

@ScottTodd pointed me towards this: https://github.com/iree-org/iree/blob/1f69b857fffb2367682b436684cd9868329cd109/compiler/plugins/target/VulkanSPIRV/VulkanSPIRVTarget.cpp#L127-L130

It seems that the dialect isn't registered by this Vulkan SPIR-V target-specific code, but it is by ROCm's:

https://github.com/iree-org/iree/blob/1f69b857fffb2367682b436684cd9868329cd109/compiler/plugins/target/ROCM/ROCMTarget.cpp#L236-L244

So, essentially, this is a bug that only affects builds which don't enable all the backends.

Adding IREEGPUDialect to the Vulkan list fixes the build for me.