fix(easy/rainbow-table): align hash helpers with uint32 iterative semantics#237
Open
agicy wants to merge 1 commit intoAlphaGPU:mainfrom
Open
fix(easy/rainbow-table): align hash helpers with uint32 iterative semantics#237agicy wants to merge 1 commit intoAlphaGPU:mainfrom
agicy wants to merge 1 commit intoAlphaGPU:mainfrom
Conversation
…tive semantics The FNV-1a hash is applied iteratively R times, so the helper's input and output must be consistently typed as unsigned 32-bit integers. - CUDA: change `fnv1a_hash` input to `unsigned int` and mask to `0xFFu` - Mojo: change `fnv1a_hash` input/mask to `UInt32` - JAX/CuTe: remove internal casting so the helper expects normalized state - PyTorch/Triton: left unchanged due to framework specific constraints Resolves AlphaGPU#214
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
Resolves #214.
The Rainbow Table challenge requires R rounds of iterative hashing, meaning the output of one round feeds directly into the next. Several starter templates previously declared their
fnv1a_hashhelpers with signed integers or performed internal type casting, creating an inconsistent internal state.This PR ensures the hash helpers consistently operate on unsigned 32-bit integers, leaving initial type normalization to the caller.
Changes
fnv1a_hash(int input)tounsigned int. Used0xFFu.fnv1a_hash(input: Int32)toUInt32.astype/cute.Uint32) from the helper body. Added Python type hints to CuTe.(Note: PyTorch uses
int64to bypass missinguint32bitwise op support in the framework. Triton remains untyped per Triton DSL conventions. Both are left unchanged.)