MCPcopy Create free account
hub / github.com/deepspeedai/DeepSpeed / _native_kernel_ready

Function _native_kernel_ready

deepspeed/module_inject/segment_ki.py:115–126  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

113
114
115def _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
129class DualWeightGluGEMV(torch.autograd.Function):

Callers 3

forwardMethod · 0.85
forwardMethod · 0.85
apply6Method · 0.85

Calls 2

get_acceleratorFunction · 0.90
on_acceleratorMethod · 0.45

Tested by

no test coverage detected