[mlir][dxsa] Add root dxsa.module#155
Open
tagolog wants to merge 1 commit into
Open
Conversation
Wraps the program into a module with optional attributes program type and shader version.
When the binary has no header both attributes are omitted.
Example:
dxsa.module pixel_shader 5 0 {
dxsa.dcl_global_flags <refactoringAllowed>
}
dxsa.module {
dxsa.dcl_global_flags <refactoringAllowed>
}
Signed-off-by: Vladimir Shiryaev <tagolog@users.noreply.github.com>
asavonic
reviewed
Jun 1, 2026
| parser.getContext(), *programType)); | ||
|
|
||
| unsigned major = 0, minor = 0; | ||
| if (parser.parseInteger(major) || parser.parseInteger(minor)) |
Contributor
There was a problem hiding this comment.
If we declare major and minor as uint8_t, then parseInteger is going to check that the value is in range.
We can also omit static_cast below.
| } | ||
|
|
||
| ParseResult ModuleOp::parse(OpAsmParser &parser, OperationState &result) { | ||
| Region *body = result.addRegion(); |
Contributor
There was a problem hiding this comment.
Let's move body initialization closer to its first use.
|
|
||
| Module createModule(mlir::dxsa::ProgramTypeAttr programType, | ||
| mlir::dxsa::ShaderVersionAttr shaderVersion, | ||
| FileLineColLoc loc) { |
Contributor
There was a problem hiding this comment.
Should we use Location instead?
| FileLineColLoc loc = getLocation(0); | ||
| std::vector<Instruction> instructions; | ||
| auto header = parseProgramHeader(); | ||
| if (failed(header)) |
| #include "llvm/Support/SourceMgr.h" | ||
|
|
||
| namespace mlir::dxsa { | ||
| /// Deserializes the given binary \p source and creates a MLIR ModuleOp in the given \p context. |
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.
Wraps the program into a module with optional attributes program type and shader version. When the binary has no header both attributes are omitted.
Example:
dxsa.module pixel_shader 5 0 {
dxsa.dcl_global_flags
}
dxsa.module {
dxsa.dcl_global_flags
}