MCPcopy Create free account
hub / github.com/apache/tvm / have_tensorcore

Function have_tensorcore

python/tvm/support/nvcc.py:1070–1100  ·  view source on GitHub ↗

Either TensorCore support is provided in the compute capability or not Parameters ---------- compute_version : str, optional compute capability of a GPU (e.g. "7.0"). target : tvm.target.Target, optional The compilation target, will be used to determine arch if comp

(compute_version=None, target=None)

Source from the content-addressed store, hash-verified

1068
1069
1070def have_tensorcore(compute_version=None, target=None):
1071 """Either TensorCore support is provided in the compute capability or not
1072
1073 Parameters
1074 ----------
1075 compute_version : str, optional
1076 compute capability of a GPU (e.g. "7.0").
1077
1078 target : tvm.target.Target, optional
1079 The compilation target, will be used to determine arch if compute_version
1080 isn't specified.
1081 """
1082 if compute_version is None:
1083 if tvm.cuda(0).exist:
1084 compute_version = tvm.cuda(0).compute_version
1085 else:
1086 if target is None or "arch" not in target.attrs:
1087 warnings.warn(
1088 "Tensorcore will be disabled due to no CUDA architecture specified."
1089 "Try specifying it by adding '-arch=sm_xx' to your target."
1090 )
1091 return False
1092 compute_version = target.attrs["arch"]
1093 # Compute version will be in the form "sm_{major}{minor}"
1094 major, minor = compute_version.split("_")[1]
1095 compute_version = major + "." + minor
1096 major, _ = parse_compute_version(compute_version)
1097 if major >= 7:
1098 return True
1099
1100 return False
1101
1102
1103def have_cudagraph():

Callers

nothing calls this directly

Calls 3

parse_compute_versionFunction · 0.70
cudaMethod · 0.45
splitMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…