Merged
Conversation
…pe to ASM and YAML
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR enhances code generation for comparison and cast operations by making their opcodes more specific. It appends the operation subtype (comparison type or cast type) to the base opcode, transforming generic opcodes like ICMP, FCMP, and CAST into more specific ones like ICMP_EQ, ICMP_SGE, CAST_FPTOSI, and CAST_TRUNC.
- Extended the
getOpcode()function to append comparison and cast types to operation names - Refactored constant literal extraction into a reusable helper function
- Added support for
rhs_valueattribute in binary operations with constant RHS operands - Updated test expectations to reflect the new specific opcode naming
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| lib/NeuraDialect/Transforms/GenerateCodePass.cpp | Enhanced opcode generation to include comparison/cast types, refactored constant extraction, and added rhs_value attribute support |
| test/e2e/relu/relu_kernel.mlir | Updated test expectations to include specific CAST_TRUNC, ICMP_EQ, and ICMP_SGE opcodes |
| test/e2e/histogram/histogram_kernel.mlir | Changed generic CAST opcode to specific CAST_FPTOSI opcode |
| test/e2e/fir/fir_kernel.mlir | Added ICMP_EQ opcode and corresponding ASM output expectations |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
tancheng
approved these changes
Nov 2, 2025
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.
Fix missing constant operands in arithmetic and cmp instructions in YAML/ASM generation; add cmp_type and cast_type for YAML/ASM generation.