Conversation
…s 99.8% of it CoMet (Joubert et al., SC18 Gordon Bell) computes pairwise genomic similarity metrics. Profiling a real 2-way CCC run on a GH200 -- 18 back-to-back invocations at --num_field 800000 --num_vector 20000 --tc 6 --num_kernel 10, ~19 minutes of GPU time -- puts one CUTLASS int4 GEMM at 99.8% of it (61.87s/call), with the three surrounding kernels at 0.1%, 0.1%, and <0.1%. Only the GEMM is ported; the other three are real kernels but not hot ones, and padding the count would misreport where the time goes. Classified dense_linear_algebra rather than the genomics default of dynamic_programming/graph_traversal. CoMet's whole trick is reformulating a bit-tally count as a dense GEMM so it lands on tensor cores -- there is no recurrence and no graph, it is cutlass::gemm::device::Gemm<int4b_t,...>. Level 1 for the same reason tests/test_levels.py calls "gemm" level 1: the unusual part is the operand encoding, not the computational pattern. The extraction keeps the GEMM's mathematical contract and drops the parts with no CPU meaning. Traced from CoMet's source rather than guessed: tc_buf_write_kernel_ writes cnt_iE(v), the number of iE-valued bits in a 2-bit field code, as the int4 operand (src/tc_in.i.hh:202-210) -- not a one-hot expansion and not a reinterpret -- so the INT32 accumulator is exactly sum_f cnt_iE(left[I,f]) * cnt_jE(right[J,f]). LinearCombinationClamp is a numerical no-op at ElementOutput == ElementCompute == int32_t, and OpMultiplyAddSaturate never saturates for this data (per-field products are bounded by 4, so overflow needs >5e8 fields in one --num_tc_steps chunk), so plain accumulation is bit-exact. tc_repair_metrics_kernel_ only undoes a GPU-tiling row permutation, which a CPU port has no reason to introduce. The OpenMP decomposition mirrors CUTLASS's actual grid: one task per 128x256 output tile, the shape GemmIdentityThreadblockSwizzle + ThreadblockShape <128,256,256> produces. The warp/MMA tier below that exists to keep tensor cores fed and has no scalar-CPU analogue, so it is not reproduced. No scatter here -- each output element is owned by one tile -- so there are no atomics and the result is bit-identical across thread counts, which the port test asserts rather than grading peak-relative. Verified on Alps (aarch64, GH200): 10 port tests pass, and the e2e oracle passes all three native-emit backends including fortran, which could not be checked on macOS.
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.
…s 99.8% of it
CoMet (Joubert et al., SC18 Gordon Bell) computes pairwise genomic similarity metrics. Profiling a real 2-way CCC run on a GH200 -- 18 back-to-back invocations at --num_field 800000 --num_vector 20000 --tc 6 --num_kernel 10, ~19 minutes of GPU time -- puts one CUTLASS int4 GEMM at 99.8% of it (61.87s/call), with the three surrounding kernels at 0.1%, 0.1%, and <0.1%. Only the GEMM is ported; the other three are real kernels but not hot ones, and padding the count would misreport where the time goes.
Classified dense_linear_algebra rather than the genomics default of dynamic_programming/graph_traversal. CoMet's whole trick is reformulating a bit-tally count as a dense GEMM so it lands on tensor cores -- there is no recurrence and no graph, it is cutlass::gemm::device::Gemm<int4b_t,...>. Level 1 for the same reason tests/test_levels.py calls "gemm" level 1: the unusual part is the operand encoding, not the computational pattern.
The extraction keeps the GEMM's mathematical contract and drops the parts with no CPU meaning. Traced from CoMet's source rather than guessed: tc_buf_write_kernel_ writes cnt_iE(v), the number of iE-valued bits in a 2-bit field code, as the int4 operand (src/tc_in.i.hh:202-210) -- not a one-hot expansion and not a reinterpret -- so the INT32 accumulator is exactly sum_f cnt_iE(left[I,f]) * cnt_jE(right[J,f]). LinearCombinationClamp is a numerical no-op at ElementOutput == ElementCompute == int32_t, and OpMultiplyAddSaturate never saturates for this data (per-field products are bounded by 4, so overflow needs >5e8 fields in one --num_tc_steps chunk), so plain accumulation is bit-exact. tc_repair_metrics_kernel_ only undoes a GPU-tiling row permutation, which a CPU port has no reason to introduce.
The OpenMP decomposition mirrors CUTLASS's actual grid: one task per 128x256 output tile, the shape GemmIdentityThreadblockSwizzle + ThreadblockShape <128,256,256> produces. The warp/MMA tier below that exists to keep tensor cores fed and has no scalar-CPU analogue, so it is not reproduced. No scatter here -- each output element is owned by one tile -- so there are no atomics and the result is bit-identical across thread counts, which the port test asserts rather than grading peak-relative.
Verified on Alps (aarch64, GH200): 10 port tests pass, and the e2e oracle passes all three native-emit backends including fortran, which could not be checked on macOS.