Skip to content

Comments

Introduce bin_map_pk2#30

Open
ruanjm wants to merge 1 commit intoHazyResearch:mainfrom
ruanjm:jruan/bin_map_pk2
Open

Introduce bin_map_pk2#30
ruanjm wants to merge 1 commit intoHazyResearch:mainfrom
ruanjm:jruan/bin_map_pk2

Conversation

@ruanjm
Copy link
Contributor

@ruanjm ruanjm commented Feb 12, 2026

Make operations on tile can use pk instruction. However, this design is not decent to me. Feel free to share your idea and deprecate this design.

Besides, I did try to use if constexpr to check whether a class or structure has member function op_pk2(). However, this design doesn't work with latest hipcc... Hipcc still tries to compile the false path even if it knows the result of condiction at compile time.

@willhu-jpg
Copy link
Collaborator

willhu-jpg commented Feb 16, 2026

Ideally, we can have a if constexpr to check whether a class or structure has the op_pk2() member function.

Alternatively, we should just create a mul_pk struct and add a contexpr bool hasPacked; field to every operator struct. That way we can have a single bin_map function.

bin_map functions that operate over a single register should throw a compile-time error if it's used with a packed instruction. Otherwise, the other bin_map functions would just skip over every other register when the operator has hasPacked set to true.

The developer would now have the flexibility of choosing between using a packed or non-packed instruction.

@willhu-jpg
Copy link
Collaborator

willhu-jpg commented Feb 16, 2026

I think instead of hk::bin_map_pk2<0, 0, hkm::mul_vgpr>(oaccu, oaccu, rescale);, we can make things a bit prettier in the library and do something like hk::mul_vgpr_pk2<0, 0>(oaccu, oaccu, rescale);.

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.

2 participants