-
Notifications
You must be signed in to change notification settings - Fork 13.5k
[mlir][spirv] Replace hardcoded attribute strings with op methods #77627
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
Comments
@llvm/issue-subscribers-mlir-spirv Author: Lei Zhang (antiagainst)
Due to historical reasons we have quite some hardcoded strings for attribute names used in parser/printer and serializer/deserializer. Now in ODS we actually generate op methods for getting the names of attributes. It's better to replace the hardcoded strings for consistency. Specicially:
|
Hi! This issue may be a good introductory issue for people new to working on LLVM. If you would like to work on this issue, your first steps are:
If you have any further questions about this issue, don't hesitate to ask via a comment in the thread below. |
@llvm/issue-subscribers-good-first-issue Author: Lei Zhang (antiagainst)
Due to historical reasons we have quite some hardcoded strings for attribute names used in parser/printer and serializer/deserializer. Now in ODS we actually generate op methods for getting the names of attributes. It's better to replace the hardcoded strings for consistency. Specicially:
|
I'll work on this |
I am new to LLVM and am just trying to familiarize myself with the codebase, I started taking a look at this issue to dip my feet in the water and was wondering where I could read more about ODS generating op methods, specifically where I could access those generated getter methods for the attribute names? Thanks! |
The TableGen backend for op definition that takes in .td files to generate .inc files is in this directory. It might be hard to read directly there given the string concatenation. Typically the .inc files are generated to a path matching the source .td files. For example, you can find .inc files for SPIR-V dialect in |
I am also new to LLVM and would like to dive into this issue as well. Thank you for the information. |
Hello @antiagainst, I'm considering a series of replacements throughout the serialization codebase, such as changing op->getAttr("memory_access") to op.getMemoryAccessAttr() in serialization. Are there any specific considerations or modifications you recommend for these replacements? |
@antiagainst, |
@antiagainst @kuhar, |
Hi sorry for the late reply. What you have in the above commit looks good to me! |
Hi @antiagainst, note that the following attribute names are not generated via ODS:
Also, I remove this assertion from the Op definitions in order to use the static methods in one place (parseSourceMemoryAccessAttributes), which might be objectionable: Let me know what you think |
Yeah some attributes not generated by ODS is fine.
This shouldn't be necessary? should avoid touching this part and revert the changes in |
@antiagainst, Thank you, |
Progress towards #77627 --------- Co-authored-by: SahilPatidar <[email protected]> Co-authored-by: Lei Zhang <[email protected]>
Reopen given this is not done entirely. |
@antiagainst |
…81552) Since ODS generates getters functions for SPIRV operations' attribute names, we replace instances of these hardcoded strings in the SPIR-V dialect's op parser/printer with function calls for consistency. Fixes #77627 --------- Co-authored-by: Lei Zhang <[email protected]>
Nice, thanks for the contribution, @tw-ilson! |
Due to historical reasons we have quite some hardcoded strings for attribute names used in parser/printer and serializer/deserializer. Now in ODS we actually generate op methods for getting the names of attributes. It's better to replace the hardcoded strings for consistency. Specicially:
branch_weights
can be replaced withgetBranchWeightsAttrName().strref()
.The text was updated successfully, but these errors were encountered: