Repository navigation
fbrv:refactor export dialect llvm - #70
Merged
Merged
Conversation
Migrate the five `op_id == X::get_opid_static()` sites in the value-name and predecessor-map pre-passes to use `downcast_ref::<X>()` directly. This is the same primitive the `classify_op!` macro in ops.rs uses, so the dispatch idiom is now consistent across the export module. Removes the now-redundant `Operation::get_op::<X>().unwrap()` downcasts since `downcast_ref` already returns the typed reference. Also add a maintenance-contract doc comment to the `LlvmOp` enum spelling out the four places that need touching when adding a new op, and replace the bare `#[allow(dead_code)]` on the `Unreachable` variant with a doc comment explaining the symmetry rationale. Pure refactor: byte-identical .ll output across all 51 example kernels before and after.
nihalpasham
self-requested a review
May 24, 2026 10:44
nihalpasham
approved these changes
May 24, 2026
nihalpasham
left a comment
Collaborator
There was a problem hiding this comment.
Looks good. The split reads cleanly and LlvmOp + classify_op! is a tidy replacement for the long op_id chain.
I layered a small commit on top (c4f9803) that brings the value-name and predecessor-map pre-passes in function.rs into the same idiom: swapping the five op_id == X::get_opid_static() sites to downcast_ref::<X>(), the same primitive your macro uses internally.
Also added a maintenance-contract docstring on LlvmOp so future contributors know which four places to touch when adding an op.
Ps: Just to be sure, also smoketested this - to check .ll parity holds against main after normalizing for monomorphization ordering artifacts and it does.
meefs
pushed a commit
to meefs/cuda-oxide
that referenced
this pull request
Sep 30, 2026
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.
Closes #59.
Splits crates/dialect-llvm/src/export.rs into a module tree (config, externs, state, names, module, function, ops, types, literals, metadata) with no semantic changes and no new abstraction layers.
ops.rsreplaces theop_id == X::get_opid_static()chain with a typedLlvmOp<'op>enum dispatched viaTryFrom<&dyn Op>, populated by the classify_op! macro. Adding an op requires one macro entry and one match arm.