-
Notifications
You must be signed in to change notification settings - Fork 13.4k
vulkan: Add State Space Model (SSM) Operations Support #16463
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#version 450 | ||
|
||
#extension GL_EXT_control_flow_attributes : require | ||
|
||
#include "types.glsl" | ||
|
||
layout(constant_id = 0) const uint BLOCK_SIZE = 32; | ||
|
||
layout(local_size_x_id = 0, local_size_y = 1, local_size_z = 1) in; | ||
|
||
layout(binding = 0) readonly buffer Src0 { float src0[]; }; | ||
layout(binding = 1) readonly buffer Src1 { float src1[]; }; | ||
layout(binding = 2) buffer Dst { float dst[]; }; | ||
|
||
layout(push_constant) uniform PushConstants { | ||
uint nb01; uint nb02; | ||
uint nb11; | ||
uint dst_nb0; uint dst_nb1; uint dst_nb2; | ||
uint nc; uint ncs; uint nr; uint n_t; uint n_s; | ||
}; | ||
|
||
void main() { | ||
const uint global_thread_id = gl_GlobalInvocationID.x; | ||
const uint i2 = gl_WorkGroupID.y; | ||
const uint i3 = gl_WorkGroupID.z; | ||
|
||
if (global_thread_id >= nr || i2 >= n_t || i3 >= n_s) { | ||
return; | ||
} | ||
|
||
const uint i1 = global_thread_id; | ||
const uint src0_base = i3 * (nb02 / 4) + i2 + i1 * (nb01 / 4); | ||
const uint src1_base = i1 * (nb11 / 4); | ||
const uint dst_idx = i3 * (dst_nb2 / 4) + i2 * (dst_nb1 / 4) + i1; | ||
|
||
float sum = 0.0; | ||
[[unroll]] for (uint i0 = 0; i0 < nc; i0++) { | ||
const uint src0_idx = src0_base + i0; | ||
const uint src1_idx = src1_base + i0; | ||
sum += src0[src0_idx] * src1[src1_idx]; | ||
} | ||
|
||
dst[dst_idx] = sum; | ||
} |
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.