Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
71 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
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
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
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
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
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
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
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
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
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
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
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
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
1f18190
[UPDATE] Rebase remaining Vulkan stack after #23249 landed
mergennachin Oct 7, 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
4 changes: 4 additions & 0 deletions backends/vulkan/op_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -1612,6 +1612,10 @@ def register_full_cpp_ops():
return OpFeatures(
inputs_storage=utils.ANY_STORAGE,
inputs_dtypes=utils.FP_INT_BOOL_T,
supports_resize=True,
are_node_inputs_supported_fn=lambda node: node.target
not in (exir_ops.edge.aten.full.default, exir_ops.edge.aten.full_like.default)
or is_scalar_value_supported(node.args[1], node.meta["val"].dtype),
)


Expand Down
10 changes: 9 additions & 1 deletion backends/vulkan/runtime/graph/ops/glsl/full_buffer.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@ ${define_required_extensions("buffer", DTYPE)}
#define PRECISION ${PRECISION}

#define T ${buffer_scalar_type(DTYPE)}
$if DTYPE == "half" or DTYPE == "float":
#define FILL_DTYPE float
$elif DTYPE == "int32":
#define FILL_DTYPE int
$elif DTYPE == "uint8":
#define FILL_DTYPE uint
$else:
#error Unsupported full dtype

${define_active_storage_type("buffer")}

Expand All @@ -22,7 +30,7 @@ layout(std430) buffer;

${layout_declare_tensor(B, "w", "t_out", DTYPE, "buffer")}
${layout_declare_ubo(B, "BufferMetadata", "outp")}
${layout_declare_ubo(B, "float", "fill_value")}
${layout_declare_ubo(B, "FILL_DTYPE", "fill_value")}

layout(local_size_x_id = 0, local_size_y_id = 1, local_size_z_id = 2) in;

Expand Down
13 changes: 12 additions & 1 deletion backends/vulkan/runtime/graph/ops/glsl/full_texture.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,25 @@ ${define_required_extensions("texture3d", DTYPE)}
#define PRECISION ${PRECISION}

#define VEC4_T ${texel_load_type(DTYPE, "texture3d")}
$if DTYPE == "half" or DTYPE == "float":
#define FILL_DTYPE float
$elif DTYPE == "int32":
#define FILL_DTYPE int
$elif DTYPE == "uint8":
#define FILL_DTYPE uint
$else:
#error Unsupported full dtype

${define_active_storage_type("texture3d")}

layout(std430) buffer;

#include "indexing.glslh"
#include "convert.glslh"

${layout_declare_tensor(B, "w", "t_out", DTYPE, "texture3d")}
${layout_declare_ubo(B, "TextureMetadata", "outp")}
${layout_declare_ubo(B, "float", "fill_value")}
${layout_declare_ubo(B, "FILL_DTYPE", "fill_value")}

layout(local_size_x_id = 0, local_size_y_id = 1, local_size_z_id = 2) in;

Expand All @@ -37,6 +46,8 @@ void main() {
}

VEC4_T outtex = VEC4_T(fill_value);
$if DTYPE == "half":
outtex = round_to_half_rte(outtex);

TensorIndex4D tidx =
texture_pos_to_tensor4d_idx_simple(outp, pos, out_layout);
Expand Down
14 changes: 12 additions & 2 deletions backends/vulkan/runtime/graph/ops/impl/Full.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,17 @@ void add_full_node(
const ValueRef size_or_in,
const ValueRef fill_value,
const ValueRef out) {
float fill_value_val = graph.extract_scalar<float>(fill_value);
vkapi::BufferBindInfo fill_value_buffer;
if (graph.dtype_of(out) == vkapi::kInt) {
fill_value_buffer =
graph.create_params_buffer(graph.extract_scalar<int32_t>(fill_value));
} else if (graph.dtype_of(out) == vkapi::kBool) {
const uint32_t value = graph.extract_scalar<bool>(fill_value);
fill_value_buffer = graph.create_params_buffer(value);
} else {
fill_value_buffer =
graph.create_params_buffer(graph.extract_scalar<float>(fill_value));
}

std::string kernel_name("full");
kernel_name.reserve(kShaderNameReserve);
Expand All @@ -52,7 +62,7 @@ void add_full_node(
// Inputs and Outputs
{{out, vkapi::kWrite}},
// Shader params buffers
{graph.meta_ubo(out), graph.create_params_buffer(fill_value_val)},
{graph.meta_ubo(out), fill_value_buffer},
// Push Constants
{},
// Specialization Constants
Expand Down
157 changes: 157 additions & 0 deletions backends/vulkan/test/test_vulkan_dynamic.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,27 @@ def forward(self, x):
edge = self._lower(model, inputs[0])
self._run(edge, model, inputs, atol=0, rtol=0)

def test_dynamic_full(self):
class Full(torch.nn.Module):
def forward(self, x):
return (
torch.full(x.shape, 2.5),
torch.zeros(x.shape),
torch.ones(x.shape),
torch.full_like(x, -1.5),
torch.zeros_like(x),
torch.ones_like(x),
)

for storage in (VkStorageType.TEXTURE_3D, VkStorageType.BUFFER):
with self.subTest(storage=storage):
model = Full()
inputs = [(torch.randn(2, s, 3),) 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_logical_not(self):
class LogicalNot(torch.nn.Module):
def forward(self, x):
Expand Down Expand Up @@ -308,6 +329,29 @@ def forward(self, x):
edge = self._lower(model, inputs[0], fully_delegated=False)
self._run(edge, model, inputs, atol=0, rtol=0, equal_nan=True)

def test_integer_fill_values(self):
class IntegerFill(torch.nn.Module):
def __init__(self, dtype):
super().__init__()
self.dtype = dtype

def forward(self, x):
return (
torch.full(x.shape, 16777217, dtype=self.dtype),
torch.full_like(x, -(2**31), dtype=self.dtype),
torch.full(x.shape, 2**31 - 1, dtype=self.dtype),
)

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

def test_integer_scalar_range_fallback(self):
class LargeScalar(torch.nn.Module):
def __init__(self, kind, value):
Expand Down Expand Up @@ -367,6 +411,85 @@ def forward(self, x):
)
self._run(edge, model, inputs, atol=0, rtol=0)

def test_integer_factories_without_downcasting(self):
class IntegerFactories(torch.nn.Module):
def __init__(self, dtype):
super().__init__()
self.dtype = dtype

def forward(self, x):
return (
torch.scalar_tensor(16777217, dtype=self.dtype),
torch.full(x.shape, 2**31 - 1, dtype=self.dtype),
torch.full_like(x, -(2**31), dtype=self.dtype),
)

inputs = [(torch.zeros(3, s),) for s in (7, 2, 15, 7)]
for dtype in (torch.int32, torch.int64):
for downcast in (True, False):
with self.subTest(dtype=dtype, downcast=downcast):
model = IntegerFactories(dtype)
delegated = dtype == torch.int32 or downcast
edge = self._lower(
model,
inputs[0],
({1: Dim("s", min=2, max=16)},),
fully_delegated=delegated,
downcast_64_bit=downcast,
)
self.assertEqual(bool(_vulkan_graphs(edge)), delegated)
self._run(edge, model, inputs, atol=0, rtol=0)

def test_64_bit_inputs_without_downcasting(self):
class Input64Bit(torch.nn.Module):
def forward(self, x):
return (
x + x,
torch.full_like(x, 3, dtype=torch.int32),
torch.ones(x.shape, dtype=torch.float32),
)

model = Input64Bit()
for dtype in (torch.int64, torch.float64):
with self.subTest(dtype=dtype):
inputs = [
(torch.arange(3 * s, dtype=dtype).reshape(3, s),)
for s in (7, 2, 15, 7)
]
edge = self._lower(
model,
inputs[0],
({1: Dim("s", min=2, max=16)},),
fully_delegated=False,
downcast_64_bit=False,
)
graphs = _vulkan_graphs(edge)
self.assertTrue(graphs)
for graph in graphs:
for value in graph.values:
if isinstance(value.value, VkTensor):
self.assertNotIn(
value.value.datatype,
(VkDataType.INT64, VkDataType.FLOAT64),
)
self._run(edge, model, inputs, atol=0, rtol=0)

def test_bool_fill_values(self):
class BoolFill(torch.nn.Module):
def forward(self, x):
return (
torch.full_like(x, 0.5, dtype=torch.bool),
torch.full_like(x, -1.5, dtype=torch.bool),
torch.full(x.shape, 0, dtype=torch.bool),
)

model = BoolFill()
inputs = [(torch.zeros(3, 7),)]
for storage in (VkStorageType.TEXTURE_3D, VkStorageType.BUFFER):
with self.subTest(storage=storage):
edge = self._lower(model, inputs[0], storage=storage)
self._run(edge, model, inputs, atol=0, rtol=0)

def test_64_bit_fusion_inputs_without_downcasting(self):
class SelectScalar(torch.nn.Module):
def __init__(self, narrow):
Expand Down Expand Up @@ -636,6 +759,40 @@ def forward(self, x):
self.assertEqual(_vulkan_graphs(edge), [])
self._run(edge, model, [(x,)])

def test_fp16_scalar_rounding(self):
class CreateTensor(torch.nn.Module):
def __init__(self, value, scalar):
super().__init__()
self.value = value
self.scalar = scalar

def forward(self, x):
if self.scalar:
return torch.scalar_tensor(self.value, dtype=x.dtype)
return torch.full_like(x, self.value)

x = torch.ones(3, 7, dtype=torch.float16)
for value in (
0.3,
-1.00075,
2**-24,
-(2**-24),
2**-25,
3 * 2**-25,
65519.0,
65520.0,
1e5,
-1e5,
):
for scalar in (False, True):
if not scalar and abs(value) > 65504:
continue
for storage in (VkStorageType.TEXTURE_3D, VkStorageType.BUFFER):
with self.subTest(value=value, scalar=scalar, storage=storage):
model = CreateTensor(value, scalar)
edge = self._lower(model, (x,), storage=storage)
self._run(edge, model, [(x,)], atol=0, rtol=0)

def test_int32_buffer_reduction_shader_range(self):
from executorch.extension.pybindings.portable_lib import (
_load_for_executorch_from_buffer,
Expand Down