The CUDA kernels read raw BFloat16 pointers only, so anything else (fp16 weights, non-contiguous views) must take the composite reference path instead of raising inside the binding.
(kernel_op, hidden, *weights)
| 113 | |
| 114 | |
| 115 | def _native_kernel_ready(kernel_op, hidden, *weights) -> bool: |
| 116 | """The CUDA kernels read raw BFloat16 pointers only, so anything else |
| 117 | (fp16 weights, non-contiguous views) must take the composite reference |
| 118 | path instead of raising inside the binding.""" |
| 119 | if kernel_op is None: |
| 120 | return False |
| 121 | if not hidden.is_contiguous() or hidden.dtype is not torch.bfloat16: |
| 122 | return False |
| 123 | from deepspeed.accelerator import get_accelerator |
| 124 | if not get_accelerator().on_accelerator(hidden): |
| 125 | return False |
| 126 | return all(w.is_contiguous() and w.dtype is torch.bfloat16 for w in weights) |
| 127 | |
| 128 | |
| 129 | class DualWeightGluGEMV(torch.autograd.Function): |
no test coverage detected