KernelAbstraction printing test fails
Open
Nobody has claimed this yet.
bug
output
- Dominant language
- Julia
- Stars
- 344
- Forks
- 79
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 27
Description
Maybe we need to have a rocprintf macro that accepts args... and automatically pick formats instead of calling it in a loop.
Got exception outside of a @test
InvalidIRError: compiling gpu_kernel_print(KernelAbstractions.CompilerMetadata{KernelAbstractions.NDIteration.DynamicSize, KernelAbstractions.NDIteration.DynamicCheck, Nothing, CartesianIndices{1, Tuple{Base.OneTo{Int64}}}, KernelAbstractions.NDIteration.NDRange{1, KernelAbstractions.NDIteration.DynamicSize, KernelAbstractions.NDIteration.StaticSize{(4,)}, CartesianIndices{1, Tuple{Base.OneTo{Int64}}}, Nothing}}) in world 34123 resulted in invalid LLVM IR
Reason: unsupported call to an unknown function (call to ijl_get_nth_field_checked)
Stacktrace:
[1] getindex
@ ./tuple.jl:29
[2] iterate
@ ./tuple.jl:68
[3] #__print
@ ~/.julia/dev/AMDGPU/src/ROCKernels.jl:182
[4] macro expansion
@ ~/.julia/packages/KernelAbstractions/XhtMv/src/KernelAbstractions.jl:251
[5] macro expansion
@ ~/.julia/packages/KernelAbstractions/XhtMv/test/print_test.jl:5
[6] gpu_kernel_print
@ ~/.julia/packages/KernelAbstractions/XhtMv/src/macros.jl:81
[7] gpu_kernel_print
@ ./none:0
Hint: catch this exception as `err` and call `code_typed(err; interactive = true)` to introspect the erronous code with Cthulhu.jl
Stacktrace:
[1] check_ir(job::CompilerJob{GCNCompilerTarget, AMDGPU.Compiler.ROCCompilerParams}, args::LLVM.Module)
@ GPUCompiler ~/.julia/packages/GPUCompiler/anMCs/src/validation.jl:154
[2] macro expansion
@ ~/.julia/packages/GPUCompiler/anMCs/src/driver.jl:442 [inlined]
[3] macro expansion
@ ~/.julia/packages/TimerOutputs/LHjFw/src/TimerOutput.jl:253 [inlined]
[4] macro expansion
@ ~/.julia/packages/GPUCompiler/anMCs/src/driver.jl:441 [inlined]
[5] emit_llvm(job::CompilerJob, method_instance::Any; libraries::Bool, deferred_codegen::Bool, optimize::Bool, cleanup::Bool, only_entry::Bool, validate::Bool, ctx::ThreadSafeContext)
@ GPUCompiler ~/.julia/packages/GPUCompiler/anMCs/src/utils.jl:83
[6] emit_llvm
@ ~/.julia/packages/GPUCompiler/anMCs/src/utils.jl:77 [inlined]
[7] (::AMDGPU.Compiler.var"#61#64"{CompilerJob{GCNCompilerTarget, AMDGPU.Compiler.ROCCompilerParams}, Core.MethodInstance})(ctx::ThreadSafeContext)
@ AMDGPU.Compiler ~/.julia/dev/AMDGPU/src/compiler/codegen.jl:128
[8] ThreadSafeContext(f::AMDGPU.Compiler.var"#61#64"{CompilerJob{GCNCompilerTarget, AMDGPU.Compiler.ROCCompilerParams}, Core.MethodInstance})
@ LLVM ~/.julia/packages/LLVM/HykgZ/src/executionengine/ts_module.jl:14
[9] JuliaContext(f::AMDGPU.Compiler.var"#61#64"{CompilerJob{GCNCompilerTarget, AMDGPU.Compiler.ROCCompilerParams}, Core.MethodInstance})
@ GPUCompiler ~/.julia/packages/GPUCompiler/anMCs/src/driver.jl:74
[10] compile
@ ~/.julia/dev/AMDGPU/src/compiler/codegen.jl:127 [inlined]
[11] actual_compilation(cache::Dict{UInt64, Any}, key::UInt64, cfg::CompilerConfig{GCNCompilerTarget, AMDGPU.Compiler.ROCCompilerParams}, ft::Type, tt::Type, world::UInt64, compiler::typeof(AMDGPU.Compiler.compile), linker::typeof(AMDGPU.Compiler.link))
@ GPUCompiler ~/.julia/packages/GPUCompiler/anMCs/src/cache.jl:184
[12] cached_compilation(cache::Dict{UInt64, Any}, cfg::CompilerConfig{GCNCompilerTarget, AMDGPU.Compiler.ROCCompilerParams}, ft::Type, tt::Type, compiler::Function, linker::Function)
@ GPUCompiler ~/.julia/packages/GPUCompiler/anMCs/src/cache.jl:163
[13] macro expansion
@ ~/.julia/dev/AMDGPU/src/compiler/codegen.jl:111 [inlined]
[14] macro expansion
@ ./lock.jl:267 [inlined]
[15] rocfunction(f::typeof(Main.Testsuite.gpu_kernel_print), tt::Type; device::ROCDevice, global_hooks::NamedTuple{(), Tuple{}}, kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ AMDGPU.Compiler ~/.julia/dev/AMDGPU/src/compiler/codegen.jl:105
[16] rocfunction
@ ~/.julia/dev/AMDGPU/src/compiler/codegen.jl:101 [inlined]
[17] macro expansion
@ ~/.julia/dev/AMDGPU/src/highlevel.jl:599 [inlined]
[18] (::KernelAbstractions.Kernel{ROCBackend, KernelAbstractions.NDIteration.StaticSize{(4,)}, KernelAbstractions.NDIteration.DynamicSize, typeof(Main.Testsuite.gpu_kernel_print)})(; ndrange::Tuple{Int64}, workgroupsize::Nothing)
@ AMDGPU.ROCKernels ~/.julia/dev/AMDGPU/src/ROCKernels.jl:85
[19] Kernel
@ ~/.julia/dev/AMDGPU/src/ROCKernels.jl:82 [inlined]
[20] macro expansion
@ ~/.julia/packages/KernelAbstractions/XhtMv/test/print_test.jl:11 [inlined]
[21] macro expansion
@ ~/bin/julia-1.9.0-rc1/share/julia/stdlib/v1.9/Test/src/Test.jl:1498 [inlined]
[22] printing_testsuite(backend::Type{ROCBackend})
@ Main.Testsuite ~/.julia/packages/KernelAbstractions/XhtMv/test/print_test.jl:10
[23] macro expansion
@ ~/.julia/packages/KernelAbstractions/XhtMv/test/testsuite.jl:61 [inlined]
[24] macro expansion
@ ~/bin/julia-1.9.0-rc1/share/julia/stdlib/v1.9/Test/src/Test.jl:1498 [inlined]
[25] testsuite(backend::Type, backend_str::String, backend_mod::Module, AT::Type, DAT::Type; skip_tests::Set{String})
@ Main.Testsuite ~/.julia/packages/KernelAbstractions/XhtMv/test/testsuite.jl:9
[26] testsuite
@ ~/.julia/packages/KernelAbstractions/XhtMv/test/testsuite.jl:31 [inlined]
[27] #5
@ ~/.julia/dev/AMDGPU/test/runtests.jl:50 [inlined]
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the failure in test/print_test.jl and trace the printing path through src/ROCKernels.jl and src/macros.jl. Inspect the reported rocprintf and KernelAbstractions call sites to determine the supported argument shape. Done means the KernelAbstractions printing test compiles without invalid LLVM IR.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- compilers, testing-qa
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100