MCPcopy Create free account
hub / github.com/apache/tvm-ffi / test_torch_graph

Function test_torch_graph

tests/python/test_stream.py:132–145  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

130 torch is None or not torch.cuda.is_available(), reason="Requires torch and CUDA"
131)
132def test_torch_graph() -> None:
133 assert torch is not None
134 mod = gen_check_stream_mod()
135 device_id = torch.cuda.current_device()
136 device = tvm_ffi.device("cuda", device_id)
137 device_type = device.dlpack_device_type()
138 graph = torch.cuda.CUDAGraph()
139 stream = torch.cuda.Stream(device_id)
140 x = torch.zeros(1, device="cuda")
141 with tvm_ffi.use_torch_stream(torch.cuda.graph(graph, stream=stream)):
142 assert torch.cuda.current_stream() == stream
143 mod.check_stream(device_type, device_id, stream.cuda_stream)
144 # avoid cuda graph no capture warning
145 x = x + 1

Callers

nothing calls this directly

Calls 2

gen_check_stream_modFunction · 0.85
deviceMethod · 0.45

Tested by

no test coverage detected