Skip to content

Commit a74d0fe

Browse files
authored
[Codegen] Use "target.build.$TARGET_KIND" for all codegen functions. (#8071)
* [Codegen] Use "target.build.$TARGET_KIND" for all codegen functions. - Removed special case for "micro_dev" target. Instead, register BuildCHost as both "target.build.c" and "target.build.micro_dev". - Renamed "target.build.build.aocl_sw_emu" to "target.build.aocl_sw_emu". Appears to be a typo introduced in #841725cc585 * [micro_dev] Removed references to non-existent micro_dev device_api.micro_dev was removed in 745e542, but several references still remained. Co-authored-by: Eric Lunderberg <elunderberg@octoml.ai>
1 parent 0429c63 commit a74d0fe

File tree

11 files changed

+9
-413
lines changed

11 files changed

+9
-413
lines changed

include/tvm/runtime/device_api.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,8 +257,6 @@ inline const char* DeviceName(int type) {
257257
return "ext_dev";
258258
case kDLWebGPU:
259259
return "webgpu";
260-
case kDLMicroDev:
261-
return "micro_dev";
262260
case kDLHexagon:
263261
return "hexagon";
264262
default:

python/tvm/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
# tvm.runtime
3232
from .runtime.object import Object
3333
from .runtime.ndarray import device, cpu, cuda, gpu, opencl, cl, vulkan, metal, mtl
34-
from .runtime.ndarray import vpi, rocm, ext_dev, micro_dev, hexagon
34+
from .runtime.ndarray import vpi, rocm, ext_dev, hexagon
3535
from .runtime import ndarray as nd
3636

3737
# tvm.error

python/tvm/_ffi/runtime_ctypes.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,6 @@ class Device(ctypes.Structure):
173173
9: "vpi",
174174
10: "rocm",
175175
12: "ext_dev",
176-
13: "micro_dev",
177176
14: "hexagon",
178177
15: "webgpu",
179178
}
@@ -194,7 +193,6 @@ class Device(ctypes.Structure):
194193
"vpi": 9,
195194
"rocm": 10,
196195
"ext_dev": 12,
197-
"micro_dev": 13,
198196
"hexagon": 14,
199197
"webgpu": 15,
200198
}

python/tvm/autotvm/measure/measure_methods.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,8 +276,6 @@ def get_build_kwargs(self):
276276

277277
if "cuda" in self.task.target.keys:
278278
kwargs["cuda_arch"] = "sm_" + "".join(dev.compute_version.split("."))
279-
if self.task.target.device_name == "micro_dev":
280-
kwargs.setdefault("build_option", {})["tir.disable_vectorize"] = True
281279

282280
return kwargs
283281

python/tvm/runtime/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
# function exposures
2828
from .object_generic import convert_to_object, convert, const
2929
from .ndarray import device, cpu, cuda, gpu, opencl, cl, vulkan, metal, mtl
30-
from .ndarray import vpi, rocm, ext_dev, micro_dev
30+
from .ndarray import vpi, rocm, ext_dev
3131
from .module import load_module, enabled, system_lib
3232
from .container import String
3333
from .params import save_param_dict, load_param_dict

python/tvm/runtime/module.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -470,9 +470,6 @@ def load_module(path, fmt=""):
470470
files = [tar_temp.relpath(x) for x in tar_temp.listdir()]
471471
_cc.create_shared(path + ".so", files, cc=cc)
472472
path += ".so"
473-
# TODO(weberlo): we should probably use a more distinctive suffix for microTVM object files
474-
elif path.endswith(".obj"):
475-
fmt = "micro_dev"
476473
# Redirect to the load API
477474
return _ffi_api.ModuleLoadFromFile(path, fmt)
478475

python/tvm/runtime/ndarray.py

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -268,13 +268,10 @@ def device(dev_type, dev_id=0):
268268
assert tvm.device("cuda", 0) == tvm.cuda(0)
269269
"""
270270
if isinstance(dev_type, string_types):
271-
if "-device=micro_dev" in dev_type:
272-
dev_type = Device.STR2MASK["micro_dev"]
273-
else:
274-
dev_type = dev_type.split()[0]
275-
if dev_type not in Device.STR2MASK:
276-
raise ValueError("Unknown device type %s" % dev_type)
277-
dev_type = Device.STR2MASK[dev_type]
271+
dev_type = dev_type.split()[0]
272+
if dev_type not in Device.STR2MASK:
273+
raise ValueError("Unknown device type %s" % dev_type)
274+
dev_type = Device.STR2MASK[dev_type]
278275
return Device(dev_type, dev_id)
279276

280277

@@ -510,22 +507,6 @@ def ext_dev(dev_id=0):
510507
return Device(12, dev_id)
511508

512509

513-
def micro_dev(dev_id=0):
514-
"""Construct a micro device
515-
516-
Parameters
517-
----------
518-
dev_id : int, optional
519-
The integer device id
520-
521-
Returns
522-
-------
523-
dev : Device
524-
The created device
525-
"""
526-
return Device(13, dev_id)
527-
528-
529510
def hexagon(dev_id=0):
530511
"""Construct a Hexagon device
531512

src/runtime/module.cc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,6 @@ bool RuntimeEnabled(const std::string& target) {
139139
f_name = "target.build.stackvm";
140140
} else if (target == "rpc") {
141141
f_name = "device_api.rpc";
142-
} else if (target == "micro_dev") {
143-
f_name = "device_api.micro_dev";
144142
} else if (target == "hexagon") {
145143
f_name = "device_api.hexagon";
146144
} else if (target.length() >= 5 && target.substr(0, 5) == "nvptx") {

src/target/codegen.cc

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,9 @@ runtime::Module Build(IRModule mod, Target target) {
4747
.value()) {
4848
mod = tir::transform::SkipAssert()(mod);
4949
}
50-
std::string build_f_name;
51-
if (target->kind->name == "micro_dev") {
52-
build_f_name = "target.build.c";
53-
} else {
54-
build_f_name = "target.build." + target->kind->name;
55-
}
50+
5651
// the build function.
52+
std::string build_f_name = "target.build." + target->kind->name;
5753
const PackedFunc* bf = runtime::Registry::Get(build_f_name);
5854
ICHECK(bf != nullptr) << build_f_name << " is not enabled";
5955
return (*bf)(mod, target);

src/target/source/codegen_aocl.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ TVM_REGISTER_GLOBAL("target.build.aocl")
8484
return BuildAOCL(mod, target, false);
8585
});
8686

87-
TVM_REGISTER_GLOBAL("target.build.build.aocl_sw_emu")
87+
TVM_REGISTER_GLOBAL("target.build.aocl_sw_emu")
8888
.set_body_typed([](IRModule mod, Target target) -> runtime::Module {
8989
return BuildAOCL(mod, target, true);
9090
});

0 commit comments

Comments
 (0)