Give recast_layout and the flagged downcast a diagnostic - #3460
Open
GrigoryEvko wants to merge 1 commit into
Open
Give recast_layout and the flagged downcast a diagnostic#3460GrigoryEvko wants to merge 1 commit into
GrigoryEvko wants to merge 1 commit into
Conversation
recast_layout of a Swizzle takes a fourth branch when neither side of the type ratio is 1. A 6-bit type against an 8-bit word gives the ratio 3/4 and reaches it. That branch passes the name layout, which resolves to the cute::layout overload set, and the call to upcast then has no viable candidate. The compiler gives 73 lines and names none of the cause. downcast<N> of a flagged layout divides the flag bit count by N with an integer division. smem_ptr_flag is smem_ptr_flag_bits<1>, thus each GMMA atom of that family carries one bit, and any N above 1 takes the flag to zero. The invariant at pointer_flagged.hpp:64 states that the flag holds the bit width of one element.
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.
Summary
recast_layout(Swizzle)takes a fourth branch when neither side of the type ratio is 1, for example an 8-bit type against a 6-bit type. That branch passeslayout, which resolves to thecute::layoutoverload set atinclude/cute/layout.hpp:558, and the call toupcastthen has no viable candidate.downcast<N>of a flagged layout divides the flag bit count by N with an integer division.smem_ptr_flagissmem_ptr_flag_bits<1>, so every GMMA*_Atom_Bitscarries a flag of one bit and any N above 1 takes it to zero.// include/cute/pointer_flagged.hpp:83 + static_assert(B % N == 0, "downcast<N> of a flagged layout needs N to divide the flag bit count."); GMMA::Layout_K_SW128_Atom_Bits atom Sw<3,4,3> o smem_ptr[1b](unset) o (_8,_1024):(_1024,_1) downcast<2> Sw<3,4,3> o smem_ptr[0b](unset) o (_8,_2048):(_2048,_1) downcast<8> Sw<3,4,3> o smem_ptr[0b](unset) o (_8,_8192):(_8192,_1) after rejected at compile time