Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add -dump-module command to slangc #6638

Merged
merged 11 commits into from
Mar 20, 2025

Conversation

cheneym2
Copy link
Collaborator

@cheneym2 cheneym2 commented Mar 18, 2025

The new -dump-module command to slangc will load and disassemble a slang module, similar to what would be seen by the -dump-ir command, except that -dump-ir tells slangc to print IR as it performs some compilation command. That is, -dump-ir requires some larger compilation task.

-dump-module on the otherhand requires no additional goal and will simply load a module and print its IR to stdout independently from other compilation steps.

Its intended purpose is to inspect .slang-module files on disk. It can also be used on .slang files which will be parsed and lowered. Slang will not automatically load a ".slang-module" to disassemble if the user requested a ".slang" file. This is intentional to give the user control to inspect modules loaded from source independently from ones loaded from precompiled slang-modules on disk.

The compilation API is extended with a new IModule::disassemble() method which retrieves the string representation of the dumped IR.

Closes #6599

@cheneym2
Copy link
Collaborator Author

/format

@cheneym2 cheneym2 self-assigned this Mar 18, 2025
@cheneym2 cheneym2 added the pr: non-breaking PRs without breaking changes label Mar 18, 2025
@slangbot
Copy link
Contributor

🌈 Formatted, please merge the changes from this PR

cheneym2 added a commit to cheneym2/slang that referenced this pull request Mar 18, 2025
@cheneym2 cheneym2 marked this pull request as ready for review March 18, 2025 19:15
@cheneym2 cheneym2 requested a review from a team as a code owner March 18, 2025 19:15
@cheneym2 cheneym2 force-pushed the cheneym2/dumper branch 2 times, most recently from c31337a to cd52f2d Compare March 18, 2025 19:58
@cheneym2
Copy link
Collaborator Author

/format

@slangbot
Copy link
Contributor

🌈 Formatted, please merge the changes from this PR

cheneym2 added a commit to cheneym2/slang that referenced this pull request Mar 18, 2025
The new -dump-module command to slangc will load and disassemble a slang module, similar to what would be seen by the -dump-ir command, except that -dump-ir tells slangc to print IR as it performs some compilation command. That is, -dump-ir requires
some larger compilation task.

-dump-module on the otherhand requires no additional goal and will simply load a module and print its IR to stdout independently from other compilation steps.

Its intended purpose is to inspect .slang-module files on disk.
It can also be used on .slang files which will be parsed and lowered
if slang does not find an associated ".slang-module" version of the
module on disk.

The compilation API is extended with a new IModule::disassemble()
method which retrieves the string representation of the dumped IR.

Closes shader-slang#6599
@cheneym2
Copy link
Collaborator Author

/format

@slangbot
Copy link
Contributor

🌈 Formatted, please merge the changes from this PR

mkeshavaNV
mkeshavaNV previously approved these changes Mar 19, 2025
@cheneym2
Copy link
Collaborator Author

/format

@slangbot
Copy link
Contributor

🌈 Formatted, please merge the changes from this PR

@cheneym2 cheneym2 enabled auto-merge (squash) March 19, 2025 16:59
@expipiplus1 expipiplus1 disabled auto-merge March 20, 2025 15:38
@expipiplus1 expipiplus1 merged commit de6cc94 into shader-slang:master Mar 20, 2025
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr: non-breaking PRs without breaking changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Standalone command or utility to dump slang-module IR
5 participants