Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion python/tvm/target/target.py
Original file line number Diff line number Diff line change
Expand Up @@ -699,14 +699,25 @@ def get_arch_version(cpu_ver):
msg = "{} is not a valid Hexagon version\nvalid versions include {}"
raise ValueError(msg.format(cpu_ver, valid_hex)) from None

def get_vtcm_capacity(cpu_ver):
one_mb = 2**20
default_vtcm_sizes = {
"v65": one_mb // 4,
"v66": one_mb // 4,
"v68": 4 * one_mb,
"v69": 8 * one_mb,
"v73": 8 * one_mb,
}
return default_vtcm_sizes.get(cpu_ver, 0)

# Target configuration:
arch_version = get_arch_version(cpu_ver)
config = {
"hvx": 128,
"llvm_options": None,
"use_qfloat": arch_version >= 68,
"use_ieee_fp": False,
"vtcm_capacity": 0,
"vtcm_capacity": get_vtcm_capacity(cpu_ver),
}
config.update(kwargs)

Expand Down
4 changes: 3 additions & 1 deletion tests/python/contrib/test_hexagon/test_vtcm.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@ def _raises_exception(f):

with tvm.transform.PassContext(config={"tir.vtcm_capacity": vtcm_capacity}):
assert (
_raises_exception(lambda: tvm.build(sch.mod, target=get_hexagon_target("v68")))
_raises_exception(
lambda: tvm.build(sch.mod, target=get_hexagon_target("v68", vtcm_capacity=0))
)
== limited
), "Case 3 - context. VTCM memory allocation limiter does not work correctly "

Expand Down