[MLIR][ROCDL] Enable AsmVerbose when serializing to textual ISA#3177
Closed
fsx950223 wants to merge 2 commits into
Closed
[MLIR][ROCDL] Enable AsmVerbose when serializing to textual ISA#3177fsx950223 wants to merge 2 commits into
fsx950223 wants to merge 2 commits into
Conversation
gpu-module-to-binary's ROCDL path builds its LLVM TargetMachine with a
default-constructed TargetOptions, so AsmVerbose is off and the AMDGPU
AsmPrinter's per-kernel "Kernel info" comment block (register usage,
occupancy, LDS/scratch size) never appears in emitted ISA text -- only
the .amdgpu_metadata YAML note, which lacks an Occupancy field since
LLVM only computes/prints that inside the verbose comment.
Add a virtual ModuleToObject::getTargetOptions() hook (default: {},
matching prior behavior for NVVM and other targets) and override it in
ROCDL's SerializeGPUModuleBase to set MCOptions.AsmVerbose = true. This
only affects textual assembly output (MCAsmStreamer), not binary/ELF
emission, so it is a no-op for `format=binary`/`fatbin`.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
3 tasks
fsx950223
added a commit
to ROCm/FlyDSL
that referenced
this pull request
Jul 3, 2026
The companion LLVM patch (ROCm/llvm-project#3177) now makes ROCDL's AsmVerbose an opt-in via `-asm-verbose` in gpu-module-to-binary's `opts` argument rather than always-on, so pass it explicitly from _dump_isa. Also restores flydsl.utils.kernel_info.get_occupancy(), which was dropped from the previous commit by an editing mishap despite still being imported by tests/unit/test_kernel_info.py. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Only set MCOptions.AsmVerbose when the caller passes `-asm-verbose` in gpu-module-to-binary's `opts` command line options, rather than unconditionally enabling it for every ROCDL serialization. Callers that don't need the AsmPrinter's per-kernel "Kernel info" comments keep the prior (default off) behavior and output. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Author
|
Updated: |
fsx950223
added a commit
to ROCm/FlyDSL
that referenced
this pull request
Jul 3, 2026
The companion LLVM patch (ROCm/llvm-project#3177) now makes ROCDL's AsmVerbose an opt-in via `-asm-verbose` in gpu-module-to-binary's `opts` argument rather than always-on, so pass it explicitly from _dump_isa. Also restores flydsl.utils.kernel_info.get_occupancy(), which was dropped from the previous commit by an editing mishap despite still being imported by tests/unit/test_kernel_info.py. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Collaborator
|
Should be filed upstream https://github.com/llvm/llvm-project |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
gpu-module-to-binary's ROCDL serialization path (SerializeGPUModuleBase/ModuleToObject::getOrCreateTargetMachine) builds itsllvm::TargetMachinewith a default-constructedTargetOptions, soAsmVerboseis off.AsmPrinter's per-kernel; Kernel info:comment block (register usage, occupancy, LDS/scratch size) never appears in textual ISA output produced via this path -- only the.amdgpu_metadataYAML note survives, which has noOccupancyfield (LLVM only computes/prints occupancy inside the verbose comment).ModuleToObject::getTargetOptions()hook (default{}, so NVVM and any other target keep current behavior) and overrides it in ROCDL'sSerializeGPUModuleBaseto setMCOptions.AsmVerbose = true.AsmVerboseonly affects the textualMCAsmStreamerpath, not binary/object emission, so this is a no-op forformat=binary/fatbin-- verified compiled binaries are unaffected, onlyformat=isa/assemblyoutput gains the comment block.Motivation
Downstream (FlyDSL) wants to surface per-kernel occupancy/register info during compilation the same way Triton's
llc-based codegen does. Without this, the only kernel info source is the incomplete.amdgpu_metadatanote.Test plan
ninjabuild ofMLIRTargetLLVM/MLIRROCDLTargetsucceeds with no warnings/errors (built and installed into a downstream FlyDSL toolchain).pa_decode_ps_kernel) viagpu-module-to-binary{format=isa}and confirmed the ISA text now contains; Kernel info: ... ; Occupancy: N, matching the AsmPrinter's actual register allocation (NumVgprs,NumSgprs, etc.).clang-format --dry-run --Werrorclean on all 4 changed files.🤖 Generated with Claude Code