MCPcopy Create free account
hub / github.com/NVIDIA/cuda-tile / bitcast

Function bitcast

python/cuda_tile/dialects/cuda_tile_ops.py:2303–2322  ·  view source on GitHub ↗
(el_type, src: Tile, *, loc=None, ip=None)

Source from the content-addressed store, hash-verified

2301
2302@cuda_tile_op
2303def bitcast(el_type, src: Tile, *, loc=None, ip=None) -> Tile:
2304 el_type = _get_mlir_type(el_type)
2305
2306 # Check that neither source nor destination types are pointer types
2307 if PointerType.isinstance(src.element_type):
2308 raise TypeError("bitcast source cannot be a pointer type")
2309 if PointerType.isinstance(el_type):
2310 raise TypeError("bitcast destination cannot be a pointer type")
2311
2312 result_type = TileType.get(src.shape, el_type)
2313 from_width = src.element_type.width
2314 to_width = el_type.width
2315 if from_width != to_width:
2316 raise TypeError(
2317 f"mismatching bitwidth between {src.element_type} ({from_width}) "
2318 f"and {result_type.element_type} ({to_width})"
2319 )
2320 return return_results(
2321 _cuda_tile.BitcastOp(result=result_type, source=src, loc=loc, ip=ip)
2322 )
2323
2324
2325def _get_element_bit_width(elem_type) -> int:

Callers

nothing calls this directly

Calls 3

_get_mlir_typeFunction · 0.85
return_resultsFunction · 0.85
getMethod · 0.80

Tested by

no test coverage detected