Introduce EqualElementTypesOpTrait to replace manual element type verification#933
Introduce EqualElementTypesOpTrait to replace manual element type verification#933
Conversation
…muteOp, and RegisterOp Co-authored-by: ftynse <1512299+ftynse@users.noreply.github.com>
Co-authored-by: ftynse <1512299+ftynse@users.noreply.github.com>
Co-authored-by: ftynse <1512299+ftynse@users.noreply.github.com>
Co-authored-by: ftynse <1512299+ftynse@users.noreply.github.com>
|
@copilot there's a build error, please fix |
Co-authored-by: ftynse <1512299+ftynse@users.noreply.github.com>
|
@copilot there is still a build failure: |
…alueTypeRange Co-authored-by: ftynse <1512299+ftynse@users.noreply.github.com>
Fixed in 05744cf. The |
Signed-off-by: Alex Zinenko <git@ozinenko.com>
Signed-off-by: Alex Zinenko <git@ozinenko.com>
martin-luecke
left a comment
There was a problem hiding this comment.
LGTM,
just a nit and a missing test.
@copilot pls fix
| // Get the reference type from the first operand if available, otherwise from | ||
| // the first result | ||
| Type referenceType; | ||
| std::string referenceName; |
There was a problem hiding this comment.
@copilot Use LLVM data stuctures where possible. This should probably be StringRef and std::to_string is also not idiomatic LLVM
There was a problem hiding this comment.
Fixed in 0b07423. Changed std::string referenceName to llvm::StringRef referenceName and replaced std::to_string with llvm::Twine.
| @@ -843,7 +843,7 @@ func.func @broadcast_explicit_dims_with_fully_specified_types(%arg0: !wave.tenso | |||
|
|
|||
| func.func @broadcast_element_type_mismatch(%arg0: !wave.tensor<[@M, @N] of f32, <register>>) { | |||
There was a problem hiding this comment.
@copilot Please also a negative test for ExtractOp, where the trait was added as well.
There was a problem hiding this comment.
Added in 0b07423. Added test extract_element_type_mismatch that verifies the trait catches element type mismatches between source and result.
- Changed std::string to llvm::StringRef for referenceName - Changed std::to_string to llvm::Twine for string concatenation - Added negative test for ExtractOp element type mismatch Co-authored-by: martin-luecke <16363540+martin-luecke@users.noreply.github.com>
EqualElementTypesOpTraitto WaveInterfaces.tdSummary
This PR introduces a new
EqualElementTypesOpTraitto replace manual element type verification in Wave operations. The trait verifies that all operands and results of an operation have the same element type.Changes Made
New Trait Implementation:
WaveInterfaces.tdWaveInterfaces.handWaveInterfaces.cppllvm::StringReffor string storage (LLVM best practice)llvm::Twinefor string concatenation (LLVM best practice)Applied to Operations:
RegisterOp: Verifies scalar init type matches tensor/vector element typeExtractOp: Verifies source and result element types matchBroadcastOp: Verifies source and result element types matchPermuteOp: Verifies input and result element types matchRemoved Manual Verification:
Updated Tests:
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.