ATen icon indicating copy to clipboard operation
ATen copied to clipboard

Which AT_DISPATCH... file should be used?

Open unholdmx opened this issue 4 months ago • 0 comments

I have a very hard time understanding, which AT_DISPATCH from here needs to be used in order to write tensors of different dtypes to a kernel.

While I understand, how #define AT_DISPATCH_FLOATING_TYPES(TYPE, NAME, ...) or #define AT_DISPATCH_INTEGRAL_TYPES(TYPE, NAME, ...) can be used when all tensors have the same dtype, (here in a torch environment)

  AT_DISPATCH_FLOATING_TYPES(at::ScalarType::Float,"Some floating error message", [&] {
    some_cuda_kernel<scalar_t><<<blocks, threads>>>(
      some_float_tensor.packed_accessor<scalar_t,2,torch::RestrictPtrTraits,size_t>(),
     .... 
    );
    }
  );

all attempts to dispatch tensors when both tensors have different dtypes fail.

unholdmx avatar Feb 20 '24 23:02 unholdmx