Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
89 commits
Select commit Hold shift + click to select a range
960ea18
Refuse a CUDA graph replay when an input changes shape
shoumikhin Oct 30, 2026
5f3ce38
List the CUDA index shims in the wheel's shared library check
shoumikhin Oct 30, 2026
c4cb8cf
Test aoti_torch_get_size
shoumikhin Oct 30, 2026
301e0e1
Test more CUDA index shim and CUDA graph cases
shoumikhin Oct 30, 2026
03e2c82
Run a CUDA graph capture call without a graph when the capture fails
shoumikhin Oct 30, 2026
bf99895
Say which dim differs when a CUDA graph replay refuses an input
shoumikhin Oct 30, 2026
5202db7
Log an expected CUDA graph capture failure at Info
shoumikhin Oct 30, 2026
1d638d8
Record CUDA graph allocations only after the first launch
shoumikhin Oct 30, 2026
474e661
Check the new CUDA graph input shapes in the recapture and replay tests
shoumikhin Oct 30, 2026
69d8749
Delete the antialiased resize torch.compile test
shoumikhin Oct 30, 2026
8eafbbd
Say why the antialiased resize avoids a conditional
shoumikhin Oct 30, 2026
ce87740
Refuse a hand-built data name in AOTI backends that keep data in the …
shoumikhin Oct 30, 2026
84d1468
Warn that CUDA data names differing only in case can share a file
shoumikhin Oct 30, 2026
f86630c
Correct comments on the CUDA index shims and set_output_data_ptr
shoumikhin Oct 30, 2026
4b7dabd
Seed the CUDA random shims from std::random_device
shoumikhin Oct 30, 2026
26d0612
Run a CUDA method that keeps host state without a graph
shoumikhin Oct 30, 2026
bfca1cd
Check the AOTI data name before compiling
shoumikhin Oct 30, 2026
19a6331
Check delegation and restore deterministic mode in the CUDA index shi…
shoumikhin Oct 30, 2026
f332a88
Fix the CUDA graph capture guard comment
shoumikhin Oct 30, 2026
7eaf9ea
Copy through a boolean mask with where in the CUDA backend
shoumikhin Oct 30, 2026
ebca400
Drop tensor checks before the CUDA backend compiles a program
shoumikhin Oct 30, 2026
9e380c8
Test the CUDA masked copy pass and the capture retry end to end
shoumikhin Oct 30, 2026
3c73496
Remove a size check only when it tests the index's count
shoumikhin Oct 30, 2026
423ebaf
Say why a CUDA method keeps its graph off for host constants
shoumikhin Oct 30, 2026
ccc1259
Keep destroy() with the other public CUDA backend methods
shoumikhin Oct 30, 2026
984df09
Draw the CUDA RNG seed before allocating its state
shoumikhin Oct 30, 2026
1bfa4de
Format the RemoveAssertAsyncPass import with ufmt
shoumikhin Oct 30, 2026
76f519a
Load float64 weights in the CUDA backend
shoumikhin Oct 30, 2026
ebcde7b
Decompose aten._reshape_copy in the CUDA backend
shoumikhin Oct 30, 2026
2fa5105
Add aoti_torch_dtype_float64 to aoti_cuda_shims.lib
shoumikhin Oct 30, 2026
f9d29a1
Retrigger CI
shoumikhin Oct 30, 2026
89bebfa
Add a CUDA shim for scatter_reduce with amax, amin, prod and mean
shoumikhin Oct 30, 2026
f23afa8
Retrigger CI
shoumikhin Oct 31, 2026
da1db73
Decompose varlen_attn in the CUDA backend
shoumikhin Oct 31, 2026
8a4ebbf
Test the int64 scatter sum in the CUDA backend instead of expecting i…
shoumikhin Oct 31, 2026
4120761
Use a model PyTorch 2.14 can export in the CUDA tensor check test
shoumikhin Oct 31, 2026
1a0704a
Check that the CUDA mask tests try a graph capture
shoumikhin Oct 31, 2026
7084c6f
Pin the masked copy pass's integer index and shared picks guards
shoumikhin Oct 31, 2026
0869711
Compare masks without recursion in the CUDA masked copy pass
shoumikhin Oct 31, 2026
e29e302
Accept float64 in the CUDA shims that still refused it
shoumikhin Oct 31, 2026
fe11987
Count a scatter mean in the tensor's dtype, as ATen does
shoumikhin Oct 31, 2026
9e707a6
Retry the CUDA random state setup when its seed copy fails
shoumikhin Oct 31, 2026
4341022
List every exported CUDA shim in the Windows import library
shoumikhin Oct 31, 2026
05e7d7a
Keep buffer updates across calls in AOTI backends with PyTorch 2.14
shoumikhin Oct 31, 2026
b66b64e
Test that the CUDA missing-kernel check sees the scatter fallback
shoumikhin Oct 31, 2026
951d55b
Drop a redundant branch from the masked copy pass and describe what i…
shoumikhin Oct 31, 2026
911db99
Read a float64 scalar in the CUDA float64 shim test
shoumikhin Oct 31, 2026
4a8bc18
Use a scatter the CUDA backend lacks in the missing-kernel test
shoumikhin Oct 31, 2026
900d0ee
Return a contiguous output from the CUDA varlen_attn decomposition
shoumikhin Oct 31, 2026
5c5d262
Refuse varlen_attn windows on which Flash attention versions differ
shoumikhin Oct 31, 2026
e9a232f
Keep NaN values outside the key sequences out of varlen_attn outputs
shoumikhin Oct 31, 2026
9680613
Correct the comments on the AOTI folding fix and the scatter kernel test
shoumikhin Oct 31, 2026
c3a6f91
Test the count check guard in the masked copy pass
shoumikhin Oct 31, 2026
a4767c3
Correct two comments in the CUDA index shim tests
shoumikhin Oct 31, 2026
89c4d5f
Test a scatter mean count that wraps to zero
shoumikhin Oct 31, 2026
d6f4a34
Say the CUDA random state setup failed, not its allocation
shoumikhin Oct 31, 2026
1f884d9
Add the float16 scalar read to the CUDA shims
shoumikhin Oct 31, 2026
3cd283f
Make two varlen_attn decomposition comments exact
shoumikhin Oct 31, 2026
eebec99
Say that float accumulation in the CUDA index_put shim can still roun…
shoumikhin Oct 31, 2026
ba1c036
Say what loading CUDA weights waits for in the stream docs
shoumikhin Oct 31, 2026
f342450
Index the CUDA mask test with a negative int32 column
shoumikhin Oct 31, 2026
a9fc94a
Say the CUDA scatter_reduce sum loses less to rounding, not nothing
shoumikhin Oct 31, 2026
53a0623
Drop the unused libgomp dependency from CUDA backend programs
shoumikhin Oct 31, 2026
5a94bfa
Keep keys past the end out of the CUDA Triton SDPA softmax
shoumikhin Oct 31, 2026
4dc4d5a
Remove the CUDA backend's temporary library when a load fails
shoumikhin Oct 31, 2026
624b83a
Point the CUDA backend's libgomp TODO at the PyTorch fix
shoumikhin Oct 31, 2026
4f53e3d
Add a CUDA shim for scatter with a tensor source
shoumikhin Oct 31, 2026
96e111d
Let the CUDA scatter shims read an int32 index
shoumikhin Oct 31, 2026
f021c76
Write each element once in the CUDA scatter shim
shoumikhin Oct 31, 2026
f6108de
Name the calling CUDA scatter shim in its errors
shoumikhin Oct 31, 2026
c1baac9
Say which ATen kernel the CUDA scatter bounds check matches
shoumikhin Oct 31, 2026
ab9ed1c
Run a CUDA graph capture that reads a device value without a graph
shoumikhin Nov 1, 2026
10f3e2f
Rewrite masked copies inside torch.cond branches too
shoumikhin Nov 1, 2026
2b350d9
Keep the CUDA compile patches in place while any thread lowers
shoumikhin Nov 1, 2026
ba5d868
Pass a float read with .item() to Triton kernels as a float
shoumikhin Nov 1, 2026
d996e09
Say the AOTI folding switch covers the whole program
shoumikhin Nov 1, 2026
2a09294
Test the CUDA scatter shims on more layouts, dtypes and edge cases
shoumikhin Nov 1, 2026
cb41bb9
Run the varlen_attn and _reshape_copy programs in the CUDA tests
shoumikhin Nov 1, 2026
b2137cd
Keep PyTorch's internal test helpers out of the CUDA index shim tests
shoumikhin Nov 1, 2026
ec7046c
Assign the CUDA compile patches explicitly
shoumikhin Nov 1, 2026
19a8028
Test that the masked copy pass keeps two random masks apart
shoumikhin Nov 1, 2026
e922a55
Check that a failed CUDA graph capture is tried only once
shoumikhin Nov 1, 2026
7e59c0a
Lower the _reshape_copy and varlen_attn programs on ROCm again
shoumikhin Nov 1, 2026
8f9dc8f
Use a stable softmax in the CUDA varlen_attn decomposition
shoumikhin Nov 2, 2026
fa053a7
Keep masked copies whose layouts differ
shoumikhin Nov 2, 2026
88f1538
Tidy the masked copy pass and its tests
shoumikhin Nov 2, 2026
b508df4
Check that the CUDA backend runs RemoveAssertAsyncPass
shoumikhin Nov 2, 2026
fd5948e
Clarify CUDA backend names and comments
shoumikhin Nov 2, 2026
fab02c4
Compare the varlen_attn decomposition with the op on CUDA only
shoumikhin Nov 2, 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 .ci/scripts/wheel/test_shared_libraries.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@
"aoti_torch_cuda_randint_low_out",
"aoti_torch_cuda_sort_stable",
"aoti_torch_cuda_guard_set_index",
"aoti_torch_cuda_index_Tensor",
"aoti_torch_index_put_out",
"aoti_torch_cuda_scatter_reduce_two_out",
"aoti_torch_cuda_scatter_src_out",
)

_QUANTIZED_KERNEL_SYMBOLS = (
Expand Down
41 changes: 31 additions & 10 deletions backends/aoti/aoti_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,22 @@ def _checked_data_name(data_name: str) -> str:
return data_name


def _written_buffer_options(program: ExportedProgram) -> Dict[str, Any]:
"""Inductor options for a program that writes a buffer.

They turn off Inductor's joint-graph constant folding for the whole
program, not only for the buffers it writes. Before torch 2.15, that
folding can turn the update of a one-element buffer, such as a counter,
into its value at export, so every call writes that same value
(https://github.com/pytorch/pytorch/pull/185077).

TODO: remove once the pinned torch is 2.15 or newer.
"""
if program.graph_signature.buffers_to_mutate:
return {"joint_graph_constant_folding": False}
return {}


@experimental(
"This API and all of aoti-driven backend related functionality are experimental."
)
Expand Down Expand Up @@ -286,9 +302,13 @@ def preprocess(
Preprocess the edge program and compile it using AOTInductor.
Weights are always separated from the SO file.
"""
# First, so that a backend keeping its data in the .pte refuses a data
# name before anything is compiled.
data_name = cls.data_name_from_compile_specs(compile_specs)
device_name = cls.get_device_name()
decomposition_table = cls.get_decomposition_table()
options = cls.get_aoti_compile_options(compile_specs)
options.update(_written_buffer_options(edge_program))

# Move the edge_program to the target device. Routed through a hook so
# backends can keep large non-parameter tensors (e.g. KV-cache buffers)
Expand Down Expand Up @@ -390,11 +410,7 @@ def preprocess(
named_data_store.add_named_data(so_blob_key, so_data, 1, None)
# Determine whether to save named data externally based on backend setting
# External: save to separate .ptd file, otherwise merge with .pte file
external_tag = (
cls.data_name_from_compile_specs(compile_specs)
if cls.save_data_externally()
else None
)
external_tag = data_name if cls.save_data_externally() else None

named_data_store.add_named_data(weights_blob_key, blob_data, 1, external_tag)

Expand Down Expand Up @@ -435,11 +451,7 @@ def generate_data_name_compile_spec(cls, data_name: str) -> CompileSpec:
Generate a CompileSpec that names the external data file, written as
``<data_name>.ptd``, so several programs can share a folder.
"""
if not cls.save_data_externally():
raise ValueError(
f"{cls.__name__} keeps its data in the .pte file, so it takes no "
"data name"
)
cls._check_saves_data_externally()
return CompileSpec(
COMPILE_SPEC_KEYS.DATA_NAME.value,
_checked_data_name(data_name).encode("utf-8"),
Expand All @@ -453,9 +465,18 @@ def data_name_from_compile_specs(cls, compile_specs: List[CompileSpec]) -> str:
"""
for spec in compile_specs:
if spec.key == COMPILE_SPEC_KEYS.DATA_NAME.value:
cls._check_saves_data_externally()
return _checked_data_name(spec.value.decode("utf-8"))
return f"aoti_{cls.get_device_name()}_blob"

@classmethod
def _check_saves_data_externally(cls) -> None:
if not cls.save_data_externally():
raise ValueError(
f"{cls.__name__} keeps its data in the .pte file, so it takes no "
"data name"
)

@classmethod
def method_name_from_compile_specs(
cls,
Expand Down
4 changes: 4 additions & 0 deletions backends/aoti/common_shims_slim.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,10 @@ int32_t aoti_torch_dtype_float32() {
return 6; // ScalarType::Float
}

int32_t aoti_torch_dtype_float64() {
return 7; // ScalarType::Double
}

int32_t aoti_torch_dtype_bfloat16() {
return 15; // ScalarType::BFloat16
}
Expand Down
1 change: 1 addition & 0 deletions backends/aoti/common_shims_slim.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ aoti_torch_get_device_index(Tensor* tensor, int32_t* ret_device_index);
// ============================================================

AOTI_SHIM_EXPORT int32_t aoti_torch_dtype_float32();
AOTI_SHIM_EXPORT int32_t aoti_torch_dtype_float64();
AOTI_SHIM_EXPORT int32_t aoti_torch_dtype_bfloat16();
AOTI_SHIM_EXPORT int32_t aoti_torch_dtype_float16();
AOTI_SHIM_EXPORT int32_t aoti_torch_dtype_int64();
Expand Down
14 changes: 11 additions & 3 deletions backends/aoti/slim/c10/core/ScalarType.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@
#include <ostream>

#include <executorch/runtime/core/portable_type/bfloat16.h>
#include <executorch/runtime/core/portable_type/half.h>
#include <executorch/runtime/platform/assert.h>

namespace executorch::backends::aoti::slim::c10 {

// Import BFloat16 from ExecuTorch's portable_type
// Import BFloat16 and Half from ExecuTorch's portable_type
using BFloat16 = ::executorch::runtime::etensor::BFloat16;
using Half = ::executorch::runtime::etensor::Half;

/// Enum representing the scalar type (dtype) of tensor elements.
/// Note: Enum values must match PyTorch's c10::ScalarType for compatibility.
Expand All @@ -30,7 +32,7 @@ enum class ScalarType : int8_t {
Long = 4, // int64_t
Half = 5, // float16
Float = 6, // float
// Double = 7, // double - not currently needed
Double = 7, // double
// ComplexHalf = 8,
// ComplexFloat = 9,
// ComplexDouble = 10,
Expand All @@ -50,6 +52,7 @@ constexpr ScalarType kInt = ScalarType::Int;
constexpr ScalarType kLong = ScalarType::Long;
constexpr ScalarType kHalf = ScalarType::Half;
constexpr ScalarType kFloat = ScalarType::Float;
constexpr ScalarType kDouble = ScalarType::Double;
constexpr ScalarType kBool = ScalarType::Bool;
constexpr ScalarType kBFloat16 = ScalarType::BFloat16;

Expand All @@ -72,6 +75,8 @@ inline size_t elementSize(ScalarType t) {
return 2; // sizeof(__half) = 2 bytes
case ScalarType::Float:
return sizeof(float);
case ScalarType::Double:
return sizeof(double);
case ScalarType::Bool:
return sizeof(bool);
case ScalarType::BFloat16:
Expand Down Expand Up @@ -100,6 +105,8 @@ inline const char* toString(ScalarType t) {
return "Half";
case ScalarType::Float:
return "Float";
case ScalarType::Double:
return "Double";
case ScalarType::Bool:
return "Bool";
case ScalarType::BFloat16:
Expand All @@ -116,7 +123,7 @@ inline const char* toString(ScalarType t) {
/// @return true if the scalar type is floating point, false otherwise.
inline bool isFloatingType(ScalarType t) {
return t == ScalarType::Half || t == ScalarType::Float ||
t == ScalarType::BFloat16;
t == ScalarType::Double || t == ScalarType::BFloat16;
}

/// Checks if the scalar type is an integral type (including bool optionally).
Expand Down Expand Up @@ -157,6 +164,7 @@ inline bool isValidScalarType(ScalarType t) {
case ScalarType::Long:
case ScalarType::Half:
case ScalarType::Float:
case ScalarType::Double:
case ScalarType::Bool:
case ScalarType::BFloat16:
return true;
Expand Down
2 changes: 2 additions & 0 deletions backends/aoti/slim/c10/core/test/test_scalar_type.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ const std::vector<ScalarTypeTestData> kAllScalarTypes = {
{ScalarType::Long, 4, 8, "Long", false, true, true, false},
{ScalarType::Half, 5, 2, "Half", true, false, false, false},
{ScalarType::Float, 6, 4, "Float", true, false, false, false},
{ScalarType::Double, 7, 8, "Double", true, false, false, false},
{ScalarType::Bool, 11, 1, "Bool", false, false, true, true},
{ScalarType::BFloat16, 15, 2, "BFloat16", true, false, false, false},
};
Expand Down Expand Up @@ -224,6 +225,7 @@ TEST_F(IsValidScalarTypeTest, AllSupportedTypesAreValid) {
EXPECT_TRUE(isValidScalarType(ScalarType::Long));
EXPECT_TRUE(isValidScalarType(ScalarType::Half));
EXPECT_TRUE(isValidScalarType(ScalarType::Float));
EXPECT_TRUE(isValidScalarType(ScalarType::Double));
EXPECT_TRUE(isValidScalarType(ScalarType::Bool));
EXPECT_TRUE(isValidScalarType(ScalarType::BFloat16));
}
Expand Down
6 changes: 3 additions & 3 deletions backends/aoti/slim/core/test/test_slimtensor_basic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -508,18 +508,18 @@ TEST(SlimTensorValidationTest, InvalidDtypeUndefined) {
"");
}

TEST(SlimTensorValidationTest, InvalidDtypeDouble) {
TEST(SlimTensorValidationTest, InvalidDtypeComplexFloat) {
std::vector<int64_t> sizes = {2, 3};
std::vector<int64_t> strides = {3, 1};
size_t nbytes = 6 * sizeof(double);
size_t nbytes = 6 * 2 * sizeof(float);
Storage storage = make_cpu_storage(nbytes);

EXPECT_DEATH(
SlimTensor(
std::move(storage),
makeArrayRef(sizes),
makeArrayRef(strides),
static_cast<c10::ScalarType>(7)), // Double = 7
static_cast<c10::ScalarType>(9)), // ComplexFloat = 9
"");
}

Expand Down
8 changes: 4 additions & 4 deletions backends/aoti/slim/factory/test/test_empty.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,15 +249,15 @@ TEST(EmptyStridedTest, InvalidDtypeUndefined) {
"");
}

TEST(EmptyStridedTest, InvalidDtypeDouble) {
TEST(EmptyStridedTest, InvalidDtypeComplexFloat) {
std::vector<int64_t> sizes = {2, 3};
std::vector<int64_t> strides = {3, 1};

EXPECT_DEATH(
empty_strided(
makeArrayRef(sizes),
makeArrayRef(strides),
static_cast<c10::ScalarType>(7)), // Double = 7
static_cast<c10::ScalarType>(9)), // ComplexFloat = 9
"");
}

Expand All @@ -280,9 +280,9 @@ TEST(EmptyTest, InvalidDtypeUndefined) {
EXPECT_DEATH(empty({2, 3}, c10::ScalarType::Undefined), "");
}

TEST(EmptyTest, InvalidDtypeDouble) {
TEST(EmptyTest, InvalidDtypeComplexFloat) {
EXPECT_DEATH(
empty({2, 3}, static_cast<c10::ScalarType>(7)), // Double = 7
empty({2, 3}, static_cast<c10::ScalarType>(9)), // ComplexFloat = 9
"");
}

Expand Down
4 changes: 2 additions & 2 deletions backends/aoti/slim/factory/test/test_from_blob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -327,12 +327,12 @@ TEST(FromBlobTest, InvalidDtypeUndefined) {
from_blob(external_data, {2, 3}, c10::ScalarType::Undefined), "");
}

TEST(FromBlobTest, InvalidDtypeDouble) {
TEST(FromBlobTest, InvalidDtypeComplexFloat) {
constexpr size_t kNumFloats = 6;
float external_data[kNumFloats];

EXPECT_DEATH(
from_blob(external_data, {2, 3}, static_cast<c10::ScalarType>(7)), "");
from_blob(external_data, {2, 3}, static_cast<c10::ScalarType>(9)), "");
}

TEST(FromBlobTest, InvalidDeviceType) {
Expand Down
36 changes: 36 additions & 0 deletions backends/aoti/tests/test_common_shims_slim.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,28 @@ void runGetSizesTest(slim_c10::DeviceType device_type) {
delete tensor;
}

void runGetSizeTest(slim_c10::DeviceType device_type) {
std::vector<int64_t> sizes = {2, 3};
std::vector<int64_t> strides = calculateContiguousStrides(sizes);
slim_c10::Device device(device_type, 0);

Tensor* tensor = new Tensor(slim::empty_strided(
slim::makeArrayRef(sizes),
slim::makeArrayRef(strides),
slim_c10::ScalarType::Float,
device));

int64_t size = -1;
EXPECT_EQ(aoti_torch_get_size(tensor, 1, &size), Error::Ok);
EXPECT_EQ(size, 3);
EXPECT_EQ(aoti_torch_get_size(tensor, -2, &size), Error::Ok);
EXPECT_EQ(size, 2);
EXPECT_EQ(aoti_torch_get_size(tensor, 2, &size), Error::InvalidArgument);
EXPECT_EQ(aoti_torch_get_size(tensor, -3, &size), Error::InvalidArgument);

delete tensor;
}

void runGetStridesTest(slim_c10::DeviceType device_type) {
std::vector<int64_t> sizes = {2, 3, 4};
std::vector<int64_t> strides = calculateContiguousStrides(sizes);
Expand Down Expand Up @@ -432,6 +454,10 @@ TEST_F(CommonShimsSlimTest, GetSizes_CPU) {
runGetSizesTest(slim_c10::DeviceType::CPU);
}

TEST_F(CommonShimsSlimTest, GetSize_CPU) {
runGetSizeTest(slim_c10::DeviceType::CPU);
}

TEST_F(CommonShimsSlimTest, GetStrides_CPU) {
runGetStridesTest(slim_c10::DeviceType::CPU);
}
Expand Down Expand Up @@ -483,6 +509,13 @@ TEST_F(CommonShimsSlimTest, GetSizes_CUDA) {
runGetSizesTest(slim_c10::DeviceType::CUDA);
}

TEST_F(CommonShimsSlimTest, GetSize_CUDA) {
if (!isCudaAvailable()) {
GTEST_SKIP() << "CUDA not available";
}
runGetSizeTest(slim_c10::DeviceType::CUDA);
}

TEST_F(CommonShimsSlimTest, GetStrides_CUDA) {
if (!isCudaAvailable()) {
GTEST_SKIP() << "CUDA not available";
Expand Down Expand Up @@ -555,6 +588,7 @@ TEST_F(CommonShimsSlimTest, NullTensorArgument) {
EXPECT_EQ(
aoti_torch_get_data_ptr(nullptr, &data_ptr), Error::InvalidArgument);
EXPECT_EQ(aoti_torch_get_sizes(nullptr, &sizes), Error::InvalidArgument);
EXPECT_EQ(aoti_torch_get_size(nullptr, 0, &numel), Error::InvalidArgument);
EXPECT_EQ(aoti_torch_get_strides(nullptr, &strides), Error::InvalidArgument);
EXPECT_EQ(aoti_torch_get_dtype(nullptr, &dtype), Error::InvalidArgument);
EXPECT_EQ(aoti_torch_get_dim(nullptr, &dim), Error::InvalidArgument);
Expand All @@ -566,6 +600,7 @@ TEST_F(CommonShimsSlimTest, NullReturnPointer) {

EXPECT_EQ(aoti_torch_get_data_ptr(tensor, nullptr), Error::InvalidArgument);
EXPECT_EQ(aoti_torch_get_sizes(tensor, nullptr), Error::InvalidArgument);
EXPECT_EQ(aoti_torch_get_size(tensor, 0, nullptr), Error::InvalidArgument);
EXPECT_EQ(aoti_torch_get_strides(tensor, nullptr), Error::InvalidArgument);
EXPECT_EQ(aoti_torch_get_dtype(tensor, nullptr), Error::InvalidArgument);
EXPECT_EQ(aoti_torch_get_dim(tensor, nullptr), Error::InvalidArgument);
Expand Down Expand Up @@ -663,6 +698,7 @@ TEST_F(CommonShimsSlimTest, ConsistentPointerReturn) {
TEST_F(CommonShimsSlimTest, DTypeConstants) {
// Verify dtype constants match expected PyTorch ScalarType values
EXPECT_EQ(aoti_torch_dtype_float32(), 6); // ScalarType::Float
EXPECT_EQ(aoti_torch_dtype_float64(), 7); // ScalarType::Double
EXPECT_EQ(aoti_torch_dtype_bfloat16(), 15); // ScalarType::BFloat16
EXPECT_EQ(aoti_torch_dtype_int64(), 4); // ScalarType::Long
EXPECT_EQ(aoti_torch_dtype_int32(), 3); // ScalarType::Int
Expand Down
2 changes: 2 additions & 0 deletions backends/cuda/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,10 @@ fbcode_target(
"passes/__init__.py",
"passes/move_cond_predicate_to_cpu.py",
"passes/lower_offgraph_kv.py",
"passes/remove_assert_async.py",
"passes/replace_fused_sdpa.py",
"passes/replace_int64_floordiv.py",
"passes/replace_masked_copy_with_where.py",
],
visibility = [
"//executorch/backends/cuda/...",
Expand Down
Loading
Loading