Skip to content

Conversation

@wlewNV
Copy link
Contributor

@wlewNV wlewNV commented Jan 15, 2026

Fixes #522

Note: This change is built on-top of the tensor refactor. Once that change has been merged, this change can be moved from draft.

Add as_struct_tensor() helper to reinterpret a torch.Tensor as a tensor of struct elements, enabling more structured Slang code when porting from slang-torch.

Changes:

  • Add StructTensorRefMarshall for struct tensor marshalling
  • Support both CUDA (fast path) and non-CUDA backends (interop buffer)

Note: As stated in the parent issue, struct layout may vary between platforms due to padding/alignment.

@ccummingsNV
Copy link
Contributor

Hi - can we hold off on this until the tensor refactor perf work is done. It's a great feature, but marshalling of tensors is going to change dramatically

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support reinterpret of a torchTensor as Tensor<MyStructType, N>

2 participants