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

IR Refactor Part 2: Reflection, Semantic Categories #442

Merged
merged 19 commits into from
Jan 24, 2025

Conversation

wingertge
Copy link
Contributor

Instead of doing a very error prone conversion in the optimizer, adds new macros to automatically generate reflection info for all IR operations.
They allow decomposing the typed operation into an OpCode and a Vec<Variable> (only if all arguments are Variable, None is returned otherwise). Also allows reconstructing the typed represenation from the opcode and argument list, where applicable. Generating these conversion makes it safer and reduces the amount of code that needs to be manually added to the optimizer when adding new operations.
Also adds additional information about things like side effects and commutativity directly to operations, making it less error prone.

Additionally, introduces three new semantic categories to Operation: Arithmetic, Comparison and Bitwise. This allows breaking the monolithic Operator enum into more manageable categories.

Testing

All tests pass

Copy link
Collaborator

@maxtremblay maxtremblay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did my best to review this one, but many changes are beyond my knowledge of cubecl. Hope this review is still useful

crates/cubecl-cpp/src/shared/base.rs Show resolved Hide resolved
crates/cubecl-ir/src/reflect.rs Show resolved Hide resolved
crates/cubecl-ir/src/reflect.rs Show resolved Hide resolved
crates/cubecl-ir/src/reflect.rs Show resolved Hide resolved
crates/cubecl-ir/src/reflect.rs Show resolved Hide resolved
crates/cubecl-wgpu/src/lib.rs Outdated Show resolved Hide resolved
crates/cubecl-ir/src/reflect.rs Outdated Show resolved Hide resolved
@maxtremblay maxtremblay merged commit 42fa4bc into tracel-ai:main Jan 24, 2025
5 checks passed
@wingertge wingertge deleted the ir-refactor-2 branch January 24, 2025 16:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants