Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
130 commits
Select commit Hold shift + click to select a range
aae8159
[INITIAL] Recreate the Vulkan transformer and conformance stack with …
mergennachin Sep 29, 2026
bcab9d0
[INITIAL] Recreate the Vulkan transformer and conformance stack with …
mergennachin Sep 29, 2026
d6db604
[INITIAL] Recreate the Vulkan transformer and conformance stack with …
mergennachin Sep 29, 2026
446a5d6
[INITIAL] Recreate the Vulkan transformer and conformance stack with …
mergennachin Sep 29, 2026
fb905cf
[INITIAL] Recreate the Vulkan transformer and conformance stack with …
mergennachin Sep 29, 2026
2131a32
[INITIAL] Recreate the Vulkan transformer and conformance stack with …
mergennachin Sep 29, 2026
f310b91
[INITIAL] Recreate the Vulkan transformer and conformance stack with …
mergennachin Sep 29, 2026
f588b1e
[INITIAL] Recreate the Vulkan transformer and conformance stack with …
mergennachin Sep 29, 2026
0dfae81
[INITIAL] Recreate the Vulkan transformer and conformance stack with …
mergennachin Sep 29, 2026
5bc8471
[INITIAL] Recreate the Vulkan transformer and conformance stack with …
mergennachin Sep 29, 2026
836dc54
[INITIAL] Recreate the Vulkan transformer and conformance stack with …
mergennachin Sep 29, 2026
b708c1a
[INITIAL] Recreate the Vulkan transformer and conformance stack with …
mergennachin Sep 29, 2026
bebd775
[INITIAL] Recreate the Vulkan transformer and conformance stack with …
mergennachin Sep 29, 2026
fcf87f1
[INITIAL] Recreate the Vulkan transformer and conformance stack with …
mergennachin Sep 29, 2026
8d46517
[INITIAL] Recreate the Vulkan transformer and conformance stack with …
mergennachin Sep 29, 2026
a4d0f14
[UPDATE] Add FP16 exponent and intermediate-rounding regression tests
mergennachin Sep 29, 2026
834cdac
[UPDATE] Add FP16 exponent and intermediate-rounding regression tests
mergennachin Sep 29, 2026
9ab4c26
[UPDATE] Add FP16 exponent and intermediate-rounding regression tests
mergennachin Sep 29, 2026
b82ffd0
[UPDATE] Add FP16 exponent and intermediate-rounding regression tests
mergennachin Sep 29, 2026
0f3e873
[UPDATE] Rebase remaining Vulkan stack onto main after parts 1–3 landed
mergennachin Oct 3, 2026
ee8dffb
[UPDATE] Rebase remaining Vulkan stack onto main after parts 1–3 landed
mergennachin Oct 3, 2026
e1b9cb7
[UPDATE] Rebase remaining Vulkan stack onto main after parts 1–3 landed
mergennachin Oct 3, 2026
f089d4f
[UPDATE] Rebase remaining Vulkan stack onto main after parts 1–3 landed
mergennachin Oct 3, 2026
ea19b69
[UPDATE] Rebase remaining Vulkan stack onto main after parts 1–3 landed
mergennachin Oct 3, 2026
b066808
[UPDATE] Rebase remaining Vulkan stack onto main after parts 1–3 landed
mergennachin Oct 3, 2026
a53613d
[UPDATE] Rebase remaining Vulkan stack onto main after parts 1–3 landed
mergennachin Oct 3, 2026
863c905
[UPDATE] Rebase remaining Vulkan stack onto main after parts 1–3 landed
mergennachin Oct 3, 2026
1f058df
[UPDATE] Rebase remaining Vulkan stack onto main after parts 1–3 landed
mergennachin Oct 3, 2026
a908fab
[UPDATE] Rebase remaining Vulkan stack onto main after parts 1–3 landed
mergennachin Oct 3, 2026
1db2027
[UPDATE] Rebase remaining Vulkan stack onto main after parts 1–3 landed
mergennachin Oct 3, 2026
2cbaeb8
[UPDATE] Rebase remaining Vulkan stack onto main after parts 1–3 landed
mergennachin Oct 3, 2026
f963896
[UPDATE] Cover exact FP16 halfway rounding in texture reductions
mergennachin Oct 3, 2026
5b423ab
[UPDATE] Cover exact FP16 halfway rounding in texture reductions
mergennachin Oct 3, 2026
5dd4a73
[UPDATE] Cover exact FP16 halfway rounding in texture reductions
mergennachin Oct 3, 2026
a6a7c39
[UPDATE] Cover exact FP16 halfway rounding in texture reductions
mergennachin Oct 3, 2026
6f39097
[UPDATE] Cover exact FP16 halfway rounding in texture reductions
mergennachin Oct 3, 2026
ccc3c43
[UPDATE] Cover exact FP16 halfway rounding in texture reductions
mergennachin Oct 3, 2026
d92f175
[UPDATE] Cover exact FP16 halfway rounding in texture reductions
mergennachin Oct 3, 2026
6280b7c
[UPDATE] Cover exact FP16 halfway rounding in texture reductions
mergennachin Oct 3, 2026
07d1f04
[UPDATE] Cover exact FP16 halfway rounding in texture reductions
mergennachin Oct 3, 2026
21d613f
[UPDATE] Cover exact FP16 halfway rounding in texture reductions
mergennachin Oct 3, 2026
f4df69e
[UPDATE] Cover exact FP16 halfway rounding in texture reductions
mergennachin Oct 3, 2026
a231002
[UPDATE] Match arg-reduction partitioning to the buffer-only last-dim…
mergennachin Oct 3, 2026
cf96624
[UPDATE] Match arg-reduction partitioning to the buffer-only last-dim…
mergennachin Oct 3, 2026
e066a11
[UPDATE] Match arg-reduction partitioning to the buffer-only last-dim…
mergennachin Oct 3, 2026
b378bbd
[UPDATE] Match arg-reduction partitioning to the buffer-only last-dim…
mergennachin Oct 3, 2026
83d3ac3
[UPDATE] Match arg-reduction partitioning to the buffer-only last-dim…
mergennachin Oct 3, 2026
18ae80a
[UPDATE] Match arg-reduction partitioning to the buffer-only last-dim…
mergennachin Oct 3, 2026
0a5c17a
[UPDATE] Match arg-reduction partitioning to the buffer-only last-dim…
mergennachin Oct 3, 2026
443b4c4
[UPDATE] Match arg-reduction partitioning to the buffer-only last-dim…
mergennachin Oct 3, 2026
84e7d70
[UPDATE] Match arg-reduction partitioning to the buffer-only last-dim…
mergennachin Oct 3, 2026
b4d732b
[UPDATE] Match arg-reduction partitioning to the buffer-only last-dim…
mergennachin Oct 3, 2026
08afd6a
[UPDATE] Match arg-reduction partitioning to the buffer-only last-dim…
mergennachin Oct 3, 2026
7baf82c
[UPDATE] Add exact FP16 zero/subnormal and overflow-threshold coverage
mergennachin Oct 3, 2026
213b59f
[UPDATE] Add exact FP16 zero/subnormal and overflow-threshold coverage
mergennachin Oct 3, 2026
707344f
[UPDATE] Add exact FP16 zero/subnormal and overflow-threshold coverage
mergennachin Oct 3, 2026
2c83efe
[UPDATE] Add exact FP16 zero/subnormal and overflow-threshold coverage
mergennachin Oct 3, 2026
fb9b582
[UPDATE] Add exact FP16 zero/subnormal and overflow-threshold coverage
mergennachin Oct 3, 2026
a1453d9
[UPDATE] Add exact FP16 zero/subnormal and overflow-threshold coverage
mergennachin Oct 3, 2026
1d8b86d
[UPDATE] Add exact FP16 zero/subnormal and overflow-threshold coverage
mergennachin Oct 3, 2026
71fb388
[UPDATE] Add exact FP16 zero/subnormal and overflow-threshold coverage
mergennachin Oct 3, 2026
a31658f
[UPDATE] Add exact FP16 zero/subnormal and overflow-threshold coverage
mergennachin Oct 3, 2026
ec7f739
[UPDATE] Add exact FP16 zero/subnormal and overflow-threshold coverage
mergennachin Oct 3, 2026
32bf253
[UPDATE] Add exact FP16 zero/subnormal and overflow-threshold coverage
mergennachin Oct 3, 2026
1ad69df
[UPDATE] Exercise int32 reduction shaders directly beyond the removed…
mergennachin Oct 3, 2026
59e4479
[UPDATE] Exercise int32 reduction shaders directly beyond the removed…
mergennachin Oct 3, 2026
c5e36bc
[UPDATE] Exercise int32 reduction shaders directly beyond the removed…
mergennachin Oct 3, 2026
8d43512
[UPDATE] Exercise int32 reduction shaders directly beyond the removed…
mergennachin Oct 3, 2026
6942500
[UPDATE] Exercise int32 reduction shaders directly beyond the removed…
mergennachin Oct 3, 2026
554ab97
[UPDATE] Exercise int32 reduction shaders directly beyond the removed…
mergennachin Oct 3, 2026
35e274b
[UPDATE] Exercise int32 reduction shaders directly beyond the removed…
mergennachin Oct 3, 2026
cfa1852
[UPDATE] Exercise int32 reduction shaders directly beyond the removed…
mergennachin Oct 3, 2026
823c3b0
[UPDATE] Exercise int32 reduction shaders directly beyond the removed…
mergennachin Oct 3, 2026
c7cbf9d
[UPDATE] Exercise int32 reduction shaders directly beyond the removed…
mergennachin Oct 3, 2026
35be19b
[UPDATE] Exercise int32 reduction shaders directly beyond the removed…
mergennachin Oct 3, 2026
125693c
[UPDATE] Keep any.dim without keepdim on CPU to avoid unsupported boo…
mergennachin Oct 3, 2026
0f9c2dd
[UPDATE] Keep any.dim without keepdim on CPU to avoid unsupported boo…
mergennachin Oct 3, 2026
b8177d5
[UPDATE] Support any.dim without keepdim using texture reduction and …
mergennachin Oct 3, 2026
c312284
[UPDATE] Support any.dim without keepdim using texture reduction and …
mergennachin Oct 3, 2026
019f9be
[UPDATE] Support any.dim without keepdim using texture reduction and …
mergennachin Oct 3, 2026
0b3b02f
[UPDATE] Support any.dim without keepdim using texture reduction and …
mergennachin Oct 3, 2026
6c1b29c
[UPDATE] Support any.dim without keepdim using texture reduction and …
mergennachin Oct 3, 2026
a9cc75c
[UPDATE] Support any.dim without keepdim using texture reduction and …
mergennachin Oct 3, 2026
c0a14d0
[UPDATE] Support any.dim without keepdim using texture reduction and …
mergennachin Oct 3, 2026
cac3fe7
[UPDATE] Support any.dim without keepdim using texture reduction and …
mergennachin Oct 3, 2026
b8bd64d
[UPDATE] Support any.dim without keepdim using texture reduction and …
mergennachin Oct 3, 2026
0e49531
[UPDATE] Support any.dim without keepdim using texture reduction and …
mergennachin Oct 3, 2026
bcd89c3
[UPDATE] Rebase remaining Vulkan stack after #23245 landed
mergennachin Oct 5, 2026
e75b412
[UPDATE] Rebase remaining Vulkan stack after #23245 landed
mergennachin Oct 5, 2026
a6ea4e1
[UPDATE] Rebase remaining Vulkan stack after #23245 landed
mergennachin Oct 5, 2026
1b7b3fd
[UPDATE] Rebase remaining Vulkan stack after #23245 landed
mergennachin Oct 5, 2026
7e9462a
[UPDATE] Rebase remaining Vulkan stack after #23245 landed
mergennachin Oct 5, 2026
470f8f0
[UPDATE] Rebase remaining Vulkan stack after #23245 landed
mergennachin Oct 5, 2026
45ce291
[UPDATE] Rebase remaining Vulkan stack after #23245 landed
mergennachin Oct 5, 2026
8358f8d
[UPDATE] Rebase remaining Vulkan stack after #23245 landed
mergennachin Oct 5, 2026
4c8b011
[UPDATE] Rebase remaining Vulkan stack after #23245 landed
mergennachin Oct 5, 2026
0e50614
[UPDATE] Update
mergennachin Oct 7, 2026
2d8dbfe
[UPDATE] Update
mergennachin Oct 7, 2026
555d25c
[UPDATE] Update
mergennachin Oct 7, 2026
01a0842
[UPDATE] Update
mergennachin Oct 7, 2026
bd23052
[UPDATE] Update
mergennachin Oct 7, 2026
e9496c5
[UPDATE] Update
mergennachin Oct 7, 2026
808e461
[UPDATE] Update
mergennachin Oct 7, 2026
28390f4
[UPDATE] Update
mergennachin Oct 7, 2026
a137634
[UPDATE] Address SS-JIA review on full fill UBO types and rebase afte…
mergennachin Oct 7, 2026
eccbf5f
[UPDATE] Address SS-JIA review on full fill UBO types and rebase afte…
mergennachin Oct 7, 2026
2c59239
[UPDATE] Address SS-JIA review on full fill UBO types and rebase afte…
mergennachin Oct 7, 2026
a598907
[UPDATE] Address SS-JIA review on full fill UBO types and rebase afte…
mergennachin Oct 7, 2026
e8b2ae0
[UPDATE] Address SS-JIA review on full fill UBO types and rebase afte…
mergennachin Oct 7, 2026
25c2f9c
[UPDATE] Address SS-JIA review on full fill UBO types and rebase afte…
mergennachin Oct 7, 2026
42e536d
[UPDATE] Address SS-JIA review on full fill UBO types and rebase afte…
mergennachin Oct 7, 2026
80283ae
[UPDATE] Rebase remaining Vulkan stack onto main ad434a39ea
mergennachin Oct 7, 2026
d248f3a
[UPDATE] Rebase remaining Vulkan stack onto main ad434a39ea
mergennachin Oct 7, 2026
e8b545b
[UPDATE] Rebase remaining Vulkan stack onto main ad434a39ea
mergennachin Oct 7, 2026
7132779
[UPDATE] Rebase remaining Vulkan stack onto main ad434a39ea
mergennachin Oct 7, 2026
8bee7c7
[UPDATE] Rebase remaining Vulkan stack onto main ad434a39ea
mergennachin Oct 7, 2026
ee495eb
[UPDATE] Rebase remaining Vulkan stack onto main ad434a39ea
mergennachin Oct 7, 2026
fe403c3
[UPDATE] Rebase remaining Vulkan stack onto main ad434a39ea
mergennachin Oct 7, 2026
a7e71de
[UPDATE] Rebase remaining Vulkan stack after #23248 landed
mergennachin Oct 7, 2026
247f43f
[UPDATE] Rebase remaining Vulkan stack after #23248 landed
mergennachin Oct 7, 2026
8e9e2a6
[UPDATE] Rebase remaining Vulkan stack after #23248 landed
mergennachin Oct 7, 2026
9b3dfcb
[UPDATE] Rebase remaining Vulkan stack after #23248 landed
mergennachin Oct 7, 2026
8429e10
[UPDATE] Rebase remaining Vulkan stack after #23248 landed
mergennachin Oct 7, 2026
487bf1d
[UPDATE] Rebase remaining Vulkan stack after #23248 landed
mergennachin Oct 7, 2026
1f18190
[UPDATE] Rebase remaining Vulkan stack after #23249 landed
mergennachin Oct 7, 2026
6311011
[UPDATE] Rebase remaining Vulkan stack after #23249 landed
mergennachin Oct 7, 2026
48b288c
[UPDATE] Rebase remaining Vulkan stack after #23249 landed
mergennachin Oct 7, 2026
d54b03c
[UPDATE] Rebase remaining Vulkan stack after #23249 landed
mergennachin Oct 7, 2026
d140d0b
[UPDATE] Rebase remaining Vulkan stack after #23249 landed
mergennachin Oct 7, 2026
5f93cf9
[UPDATE] Rebase dynamic transformer integration onto origin/main; val…
mergennachin Oct 8, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion backends/vulkan/op_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -1384,7 +1384,7 @@ def register_expand_copy():
return OpFeatures(
inputs_storage=utils.ANY_STORAGE,
inputs_dtypes=utils.FP_INT_BOOL_T,
supports_resize=False,
supports_resize=True,
supports_highdim=True,
)

Expand Down
83 changes: 83 additions & 0 deletions backends/vulkan/test/test_vulkan_dynamic.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,25 @@ def _vulkan_graphs(edge):
]


class TransformerBlock(torch.nn.Module):
def __init__(self, sdpa):
super().__init__()
self.sdpa = sdpa
self.qkv = torch.nn.Linear(64, 192)
self.ff = torch.nn.Linear(64, 64)

def forward(self, x, lengths):
b, s, _ = x.shape
mask = (torch.arange(s)[None, :] < lengths[:, None])[:, None, None, :]
q, k, v = self.qkv(x).view(b, s, 3, 2, 32).permute(2, 0, 3, 1, 4)
if self.sdpa:
y = F.scaled_dot_product_attention(q, k, v, attn_mask=mask)
else:
bias = torch.where(mask, 0.0, -torch.inf)
y = torch.softmax(q @ k.transpose(-1, -2) * 32**-0.5 + bias, -1) @ v
return F.gelu(self.ff(y.transpose(1, 2).reshape(b, s, 64)))


class ConstantMask(torch.nn.Module):
def __init__(self):
super().__init__()
Expand Down Expand Up @@ -149,6 +168,50 @@ def _run(
)
)

def test_partition_transformer(self):
for sdpa in (False, True):
with self.subTest(sdpa=sdpa):
self._lower(
TransformerBlock(sdpa),
(torch.randn(1, 16, 64), torch.tensor([16])),
({1: Dim("s", min=2, max=1000)}, {}),
)

def _run_dynamic_transformer(self, sdpa):
torch.manual_seed(0)
storages = [VkStorageType.TEXTURE_3D]
# SwiftShader lacks 8-bit storage buffers, and skipping inside a
# subTest confuses the test runner.
if not USING_SWIFTSHADER:
storages.append(VkStorageType.BUFFER)
for storage in storages:
with self.subTest(storage=storage):
model = TransformerBlock(sdpa).eval()
inputs = [
(torch.randn(1, s, 64), torch.tensor([length]))
for s, length in (
(16, 16),
(7, 4),
(31, 23),
(2, 1),
(16, 0 if sdpa else 5),
)
]
edge = self._lower(
model, inputs[0], ({1: Dim("s", min=2, max=32)}, {}), storage
)
self._run(edge, model, inputs)

def test_dynamic_transformer(self):
self._run_dynamic_transformer(False)

@unittest.skipIf(
USING_SWIFTSHADER,
"SDPA requires 8-bit storage buffers even with texture preference",
)
def test_dynamic_sdpa_transformer(self):
self._run_dynamic_transformer(True)

def test_partition_any_unsupported_inputs(self):
class AnyDim(torch.nn.Module):
def forward(self, x):
Expand Down Expand Up @@ -254,6 +317,26 @@ def forward(self, x):
edge = self._lower(model, inputs[0])
self._run(edge, model, inputs, atol=0, rtol=0)

def test_dynamic_expand(self):
class Expand(torch.nn.Module):
def __init__(self):
super().__init__()
self.register_buffer(
"offset", torch.arange(4, dtype=torch.float32)[None, :]
)

def forward(self, x):
return x.expand(2, x.shape[1], 4) + self.offset.expand(2, 4)[:, None, :]

for storage in (VkStorageType.TEXTURE_3D, VkStorageType.BUFFER):
with self.subTest(storage=storage):
model = Expand()
inputs = [(torch.randn(1, s, 1),) for s in (16, 3, 31, 2, 16)]
edge = self._lower(
model, inputs[0], ({1: Dim("s", min=2, max=32)},), storage
)
self._run(edge, model, inputs, atol=0, rtol=0)

def test_dynamic_full(self):
class Full(torch.nn.Module):
def forward(self, x):
Expand Down