Commit Graph

126 Commits

Author SHA1 Message Date
Ville Pietilä
3b784ca603 clang-format 2026-01-15 05:31:52 -05:00
Ville Pietilä
dc6f8f1067 Fix WMMA conv algorithms hierarchy. 2026-01-15 05:27:22 -05:00
Ville Pietilä
2451657a14 Merge remote-tracking branch 'origin/develop' into vpietila/ckb-refactor-warp-gemm-descriptors 2026-01-15 04:36:46 -05:00
John Shumway
5122637215 [CK_BUILDER] Convert convolution traits to a struct with factory functions (#3547)
* Factor helpers out of conv_traits.hpp

* Create a non-templated conv_traits struct

* Migrate to new instance-specific instance_to_conv_traits functions

* Clean up reflection concepts

* Clean up ConvTraits helpers

* Update testing for convolution traits

This is a lot of cleanup on tests to have verbose coverage of feature
extraction, explicit tests for each supported device kernel, and
simple, readable test code.

* Address reviewer comments and resolve merge conflict
2026-01-15 10:03:21 +01:00
Ville Pietilä
75d20e08f1 clang-format 2026-01-14 09:29:04 -05:00
Ville Pietilä
096592eb99 Refactor conv algorithms into more categorized form. 2026-01-14 08:29:49 -05:00
Ville Pietilä
3f7b250d33 Small concepts clean-up. 2026-01-14 06:22:46 -05:00
Ville Pietilä
07608d1a86 Rename LDS transfer related assets. 2026-01-14 06:15:14 -05:00
Ville Pietilä
6210a83d5e Rename thread distribution to thread cluster. 2026-01-14 06:06:05 -05:00
Ville Pietilä
9908a87c31 [CK_BUILDER] Add bwd weight factories (#3509)
* Add placeholder test.

* Initial conv bwd weight factory.

* Conv builder test refactoring.

* Add missing pieces to bwd weight factory.

* Improve compile time erros message when no matching factory is found.

* Use amcro to ensure automatic macthing between concepts are their string representations.

* Improve compile time diagnostics.

* Small improvements.

* Improve missing member/wrong type compile-time errors.

* Improve compile time diagnostics.

* Concept bug fixes.

* Remove debug assert.

* Update algorithm signature diagnostics.

* Factory bug fixes.

* First functional version of bwd weight conv factory.

* Refactor handing of GEMM-K batch template parameter in conv bwd weight factory.

* Concept improvements.

* Improve concept diagnostics.

* Introduve a common size type for concepts.

* Update compiletime diagnostics to use the size type.

* Update conv specialization enum.

* Fix fwd conv builder tests.

* Fix smoke tests.

* Separate bwd weigth and bwd data tests into separate targets.

* Clean-up CK Tile builder tests.

* Add bwd weight XDL CShuffle V3 factory.

* Build conv bwd weigth v3 instances successfully.

* Add instance traits for DeviceGroupedConvBwdWeight_Xdl_CShuffleV3.

* Test fix.

* Add instance traits for bwd weight algorithms.

* Add unit tests for instance strings.

* Build new instance traits unit tests but exclude WMMA for now.

* Added factory for DeviceGroupedConvBwdWeightTwoStage_Xdl_CShuffle.

* Conv bwd weight DL factory.

* Final implementation for bwd weight DL factory.

* Add test for creating DeviceGroupedConvBwdWeightMultipleD_Xdl_CShuffle instance.

* Add factory for DeviceGroupedConvBwdWeightMultipleD_Xdl_CShuffle

* Treat ref algorithm the same way as real algorithms in the dispatcher.

* Refactor large tensor support and WMMA configuration.

* Add factory and tests for DeviceGroupedConvBwdWeight_Wmma_CShuffleV3.

* Update Readme.

* Fix WMMA bwd weight tests.

* Added factory and tests for DeviceGroupedConvBwdWeightTwoStage_Wmma_CShuffleV3.

* Factory and tests for DeviceGroupedConvBwdWeight_Wmma_CShuffle.

* Dispatching for DeviceGroupedConvBwdWeightMultipleD_Wmma_CShuffle.

* Add factory for DeviceGroupedConvBwdWeightMultipleD_Wmma_CShuffleV3

* Fix DeviceGroupedConvBwdWeightMultipleD_Wmma_CShuffleV3 factory and  compute types for input and output tensor in bwd weigth convs.

* Fix fwd factories after refactoring.

* clang-format

* Move compile-time diagnostics to a separate branch.

* Fix ref algorithm dispatching.

* Fix smoke tests.

* clang-format

* Fix factory for regular WMMA conv bwd weight.

* Clarify builder Readme.

* Remove obsolete test file.

* Fix test after merge.

* clang-format

* Remove the C++26 extensions.

* Unify conv elementwise ops and layout definitions for fwd and bwd directions.

* Remove old layout and elementwise ops.

* Unify handling of conv tensor types between fwd and bwd directions.

* Unify block transfer for fwd and bwd directions. Rename ThreadSliceDim to ThreadClusterRank.

* Make BlockTransferDescriptor concept parametrized. Introduce a common TileTransferParameters concept for conv algorithms.

* clang-format

---------

Co-authored-by: Ville Pietilä <>
2026-01-13 18:12:38 +02:00
Ville Pietilä
f9f3844dd6 Merge remote-tracking branch 'origin/vpietila/ckb-bwd-weight-factories' into vpietila/ckb-refactor-warp-gemm-descriptors 2026-01-13 10:54:36 -05:00
Ville Pietilä
faf91267ec Improve dispatcher error messages. Fix builder smoke tests. 2026-01-13 08:57:00 -05:00
Ville Pietilä
9b58c20e1c Merge remote-tracking branch 'origin/develop' into vpietila/ckb-bwd-weight-factories 2026-01-13 04:20:32 -05:00
Ville Pietilä
bf57fbf488 clang-format 2026-01-13 04:20:08 -05:00
Ville Pietilä
a8f1d44078 Make BlockTransferDescriptor concept parametrized. Introduce a common TileTransferParameters concept for conv algorithms. 2026-01-13 04:17:06 -05:00
Ville Pietilä
1d519792ca Unify block transfer for fwd and bwd directions. Rename ThreadSliceDim to ThreadClusterRank. 2026-01-13 03:19:10 -05:00
Ville Pietilä
97793cf352 Unify handling of conv tensor types between fwd and bwd directions. 2026-01-13 03:08:01 -05:00
Ville Pietilä
b5d060b6b3 Remove old layout and elementwise ops. 2026-01-13 02:44:54 -05:00
Ville Pietilä
3e8f3907f2 Unify conv elementwise ops and layout definitions for fwd and bwd directions. 2026-01-13 02:43:37 -05:00
Ville Pietilä
4f721aca8a Fix remaining fwd/bwd instances tests. 2026-01-12 11:33:46 -05:00
Ville Pietilä
46afc66543 Fix fwd/bwd conv factory tests after tile transfer XDL/WMMA concepts refactoring. 2026-01-12 09:26:04 -05:00
kabrahamAMD
20f66c1e6b adressed review comments from PR3459 (#3526)
Co-authored-by: Kevin Abraham <kevin.abraham@streamhpc.com>
2026-01-12 09:47:00 +01:00
Robin Voetter
b352a68606 ck-builder: tensor input/output reflection (#3536)
This adds some utilities to automatically generate UniqueInputs,
UniqueOutputs, alloc_inputs, alloc_outputs, and validate, based
on a Inputs::reflect() and Outputs::reflect().
2026-01-12 09:45:53 +01:00
Ville Pietilä
6bcdc10593 Fix fwd factories after refactoring. 2026-01-09 10:48:18 -05:00
Ville Pietilä
63fc27b0b1 Refactor algorithm specialization and GEMM pipeline definitions. 2026-01-09 10:05:54 -05:00
Ville Pietilä
f74e034ae9 Adapt factories to warp GEMM and transfer parameters refactoring. 2026-01-09 09:17:45 -05:00
Ville Pietilä
1abe9ab6c9 Merge branch 'vpietila/ckb-bwd-weight-factories' into vpietila/ckb-refactor-warp-gemm-descriptors 2026-01-08 06:55:01 -05:00
Ville Pietilä
6c41727997 Merge remote-tracking branch 'origin/develop' into vpietila/ckb-bwd-weight-factories 2026-01-08 05:12:35 -05:00
Robin Voetter
e3884bbf05 [CK_BUILDER] Debug utilities (#3528)
* ck-builder: make toString to_string

We are using snake case for CK-Builder

* ck-builder: add debug.hpp with tensor descriptor printing function

This adds some initial functionality to debug.hpp, a header which will
be used to house some debug utilities.

* ck-builder: abstract nd-iteration

Abstracting this makes it easier to test, clearer, and allows us to
use it elsewhere (such as in debug.hpp soon)

* ck-builder: tensor printing

* ck-builder: rename INT32 to I32

This makes it more in line with the other data type definitions.
2026-01-08 10:14:13 +01:00
Ville Pietilä
7b3aca7878 Merge remote-tracking branch 'origin/vpietila/ckb-bwd-weight-factories' into vpietila/ckb-refactor-warp-gemm-descriptors 2026-01-07 06:16:43 -05:00
Ville Pietilä
d107b851c1 Merge branch 'develop' into vpietila/ckb-bwd-weight-factories 2026-01-07 02:43:24 -08:00
Ville Pietilä
c5cdd51ce4 Fix factory for regular WMMA conv bwd weight. 2026-01-07 05:41:22 -05:00
Ville Pietilä
37e9547a29 Fix ref algorithm dispatching. 2026-01-07 03:56:50 -05:00
Robin Voetter
1c433c64ec [CK_BUILDER] Integrate reference conv with testing (#3511)
* ck-builder: explicitly delete forward declarations

Before, these functions were seen as a forward declaration for an existing function.
If no actual implementation overload could be found, these would be selected and
a linker error or warning would be generated. By marking these functions as explicitly
deleted, they incorrect invocations are generated as compile error instead.

* ck-builder: ckt::run plumbing for reference conv

This implements the ckt::run plumbing for the reference convolution
implementation and sets up the first complete end-to-end test.

* ck-builder: make validation system check for all-zeros

When both the actual and reference output are both all zero bits,
there is probably something wrong in the test framework.

* ck-builder: proper implementation+tests for TensorDescriptor::is_packed

* ck-builder: fix typos
2026-01-06 09:29:06 +01:00
Ville Pietilä
02243cabe6 Merge branch 'develop' into vpietila/ckb-bwd-weight-factories 2026-01-05 07:07:01 -08:00
Ville Pietilä
5f639559a1 WIP: Unify warp GEMM and thread distribution descriptions. 2026-01-05 09:52:46 -05:00
Robin Voetter
e6e7dc2910 [CK_BUILDER] validation (#3471)
This pull request builds on #3267 by proving the "validation" infrastructure, the means to compare a set of `Outputs`.

The design of the validation infrastructure is relatively straight forward:
- Each SIGNATURE should come with a `validate()` implementation, which should be implemented in a similar way that the other functions/types from `testing.hpp` are implemented.
- `validate()` returns a `ValidationReport`, which is a structure that keeps all relevant information about comparing the tensors from two `Outputs`. Note that crucially, `validate()` should not do any reporting by itself. Rather, glue logic should be implemented by the user to turn `ValidationReport` into a relevant error message.
- You can see this clue code for CK-Builder itself in `testing_utils.hpp`, its `MatchesReference()`. This functionality is relatively barebones right now, it will be expanded upon in a different PR to keep the scope of this one down.

The comparison is done on the GPU (using an atomic for now), to keep tests relatively quick. Some notable items from this PR:
- To help compare the tensors and with writing tests, I've written a generic function `tensor_foreach` which invokes a callback on every element of a tensor.
- For that it was useful that the `TensorDescriptor` has a rank which is known at compile-time, so I've changed the implementation of `TensorDescriptor` for that. I felt like it was a better approach than keeping it dynamic, for multiple reasons:
  - This is C++ and we should use static typing where possible and useful. This way, we don't have to implement runtime assertions about the tensor rank.
  - We know already know the rank of tensors statically, as it can be derived from the SIGNATURE.
  - It simpifies the implementation of `tensor_foreach` and other comparison code.
- There are a lot of new tests for validating the validation implementation, validating validation validation tests (Only 3 recursive levels though...). For a few of those functions, I felt like it would be useful to expose them to the user.
- Doc comments everywhere.
2026-01-05 04:57:34 -08:00
Ville Pietilä
201039646e Move compile-time diagnostics to a separate branch. 2026-01-05 05:32:09 -05:00
Ville Pietilä
881bf916fe clang-format 2026-01-05 04:45:51 -05:00
Ville Pietilä
829eabed3a Fix fwd factories after refactoring. 2026-01-05 04:42:31 -05:00
Ville Pietilä
1dcea1825f Fix DeviceGroupedConvBwdWeightMultipleD_Wmma_CShuffleV3 factory and compute types for input and output tensor in bwd weigth convs. 2026-01-05 03:09:22 -05:00
Max Podkorytov
e339101e9c [CK-Tile] move out memory operation from cshuffle epilogue class (#3359)
* initial poc

* factor out common parts in operator()

* cv4

* rest of the universal gemm pipelines

* fix test

* remove boilerplate from tile engine

* fix example

* fix example

* format

* fix tests build for gemm

* remove base pipeline codegen from gemm instance builder

* unify v3 logic with the rest of universal gemm pipelines

* fix build for multi abd test

* fix test gemm multi d

* fix build for weight preshuffle

* fix grouped gemm test

* fix grouped gemm multi d test

* fix grouped gemm preshuffle

* fix grouped gemm example except for quant

* fix gemm preshuffle

* fix splitk 2 stage example

* fix batched gemm example

* fix multid example

* fix multiabd example

* fix batched gemm test

* fixup

* fix examples build

* fix grouped gemm test build

* fix smoke builder

* hacky poc

* fix tile engine

* kill the lambda

* maybe fix test build

* more fixes

* clang-format

* save temp

* clang-format

* mostly fix examples

* clang-format

* remove dead code

* more cleanup

* fix fmha bwd build (default epilogue set/add appears to be broken)

* fix default epilogue tests but not correctness

* clang-format

* fix bquant

* clang-format

* cleanup dead code

* rearrange make windows for readability

* restore changes to IsSupportedArgument

* fix smoke-builder

* clang-format

* fixup rename class

* build fixes

* clang-format

* fix builder

* fixup

* remove set from builder tests

* fix test

* clang-format

* re-refactor the kernels

* clang-format

* fix header license

* remove memory operation from conv bwd test

* clang-format

* clang-format example,include

* clang-format test

* build fixes

* clang-format

* solve compilation error

* fix the CI

* solve compilation error

* clang format

* solve merge conflict

* solve merge conflict

* solve the gfx11 error

* solve test error

* moar build fixes

* remove AtomicAddRequiresKBatchGreaterThanOne test since the property is removed from the kernel scope

---------

Co-authored-by: Thomas Ning <Thomas.Ning@amd.com>
2026-01-04 03:28:14 -08:00
Ville Pietilä
4eea42c5b7 Add factory for DeviceGroupedConvBwdWeightMultipleD_Wmma_CShuffleV3 2026-01-02 09:52:52 -05:00
Ville Pietilä
c3a9044bad Dispatching for DeviceGroupedConvBwdWeightMultipleD_Wmma_CShuffle. 2026-01-02 09:25:38 -05:00
Ville Pietilä
1759db7250 Factory and tests for DeviceGroupedConvBwdWeight_Wmma_CShuffle. 2026-01-02 08:52:38 -05:00
Ville Pietilä
aa10d659b7 Added factory and tests for DeviceGroupedConvBwdWeightTwoStage_Wmma_CShuffleV3. 2026-01-02 07:51:40 -05:00
Ville Pietilä
bc3cba873b Add factory and tests for DeviceGroupedConvBwdWeight_Wmma_CShuffleV3. 2026-01-02 06:08:29 -05:00
Ville Pietilä
d045923a0d Refactor large tensor support and WMMA configuration. 2026-01-02 05:12:19 -05:00
Ville Pietilä
09e188f2a8 Treat ref algorithm the same way as real algorithms in the dispatcher. 2026-01-02 02:28:05 -05:00
Ville Pietilä
5be1ed65fb Merge remote-tracking branch 'origin/develop' into vpietila/ckb-bwd-weight-factories 2026-01-02 02:15:24 -05:00