Skip to content

Commit fdd6500

Browse files
authored
Future-proof 'processor to tune processor` (#6673)
1 parent 43af5b6 commit fdd6500

6 files changed

Lines changed: 13 additions & 13 deletions

File tree

python_bindings/src/PyEnums.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ void define_enums(py::module &m) {
8383
.value("WebAssembly", Target::Arch::WebAssembly);
8484

8585
// Please keep sorted.
86-
py::enum_<Target::Processor>(m, "TargetProcessor")
86+
py::enum_<Target::Processor>(m, "TargetProcessorTune")
8787
.value("TuneAMDFam10", Target::Processor::AMDFam10)
8888
.value("TuneBdVer1", Target::Processor::BdVer1)
8989
.value("TuneBdVer2", Target::Processor::BdVer2)

python_bindings/src/PyTarget.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ void define_target(py::module &m) {
3434
.def_readwrite("os", &Target::os)
3535
.def_readwrite("arch", &Target::arch)
3636
.def_readwrite("bits", &Target::bits)
37-
.def_readwrite("processor", &Target::processor)
37+
.def_readwrite("processor_tune", &Target::processor_tune)
3838

3939
.def("__repr__", &target_repr)
4040
.def("__str__", &Target::to_string)

src/CodeGen_X86.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -687,7 +687,7 @@ void CodeGen_X86::visit(const Store *op) {
687687

688688
string CodeGen_X86::mcpu() const {
689689
// First, check if any explicit request for tuning exists.
690-
switch (target.processor) { // Please keep sorted.
690+
switch (target.processor_tune) { // Please keep sorted.
691691
case Target::Processor::AMDFam10:
692692
return "amdfam10";
693693
case Target::Processor::BdVer1:

src/Module.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -615,7 +615,7 @@ void Module::compile(const std::map<OutputFileType, std::string> &output_files)
615615
}
616616
}
617617
debug(1) << "Module.compile(): static_library " << output_files.at(OutputFileType::static_library) << "\n";
618-
Target base_target(target().os, target().arch, target().bits, target().processor);
618+
Target base_target(target().os, target().arch, target().bits, target().processor_tune);
619619
create_static_library(temp_dir.files(), base_target, output_files.at(OutputFileType::static_library));
620620
}
621621
if (contains(output_files, OutputFileType::assembly)) {
@@ -923,7 +923,7 @@ void compile_multitarget(const std::string &fn_name,
923923
// and add that to the result.
924924
if (!base_target.has_feature(Target::NoRuntime)) {
925925
// Start with a bare Target, set only the features we know are common to all.
926-
Target runtime_target(base_target.os, base_target.arch, base_target.bits, base_target.processor);
926+
Target runtime_target(base_target.os, base_target.arch, base_target.bits, base_target.processor_tune);
927927
for (int i = 0; i < Target::FeatureEnd; ++i) {
928928
// We never want NoRuntime set here.
929929
if (i == Target::NoRuntime) {

src/Target.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,7 @@ bool merge_string(Target &t, const std::string &target) {
517517
return false;
518518
}
519519
os_specified = true;
520-
} else if (lookup_processor(tok, t.processor)) {
520+
} else if (lookup_processor(tok, t.processor_tune)) {
521521
if (processor_specified) {
522522
return false;
523523
}
@@ -675,9 +675,9 @@ std::string Target::to_string() const {
675675
break;
676676
}
677677
}
678-
if (processor != ProcessorGeneric) {
678+
if (processor_tune != ProcessorGeneric) {
679679
for (const auto &processor_entry : processor_name_map) {
680-
if (processor_entry.second == processor) {
680+
if (processor_entry.second == processor_tune) {
681681
result += "-" + processor_entry.first;
682682
break;
683683
}
@@ -1102,7 +1102,7 @@ bool Target::get_runtime_compatible_target(const Target &other, Target &result)
11021102
// Union of features is computed through bitwise-or, and masked away by the features we care about
11031103
// Intersection of features is computed through bitwise-and and masked away, too.
11041104
// We merge the bits via bitwise or.
1105-
Target output = Target{os, arch, bits, processor};
1105+
Target output = Target{os, arch, bits, processor_tune};
11061106
output.features = ((features | other.features) & union_mask) | ((features | other.features) & matching_mask) | ((features & other.features) & intersection_mask);
11071107

11081108
// Pick tight lower bound for CUDA capability. Use fall-through to clear redundant features

src/Target.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ struct Target {
6969
ZnVer1, /// Tune for AMD Zen CPU (AMD Family 17h, launched 2017).
7070
ZnVer2, /// Tune for AMD Zen 2 CPU (AMD Family 17h, launched 2019).
7171
ZnVer3, /// Tune for AMD Zen 3 CPU (AMD Family 19h, launched 2020).
72-
} processor = ProcessorGeneric;
72+
} processor_tune = ProcessorGeneric;
7373

7474
/** Optional features a target can have.
7575
* Corresponds to feature_name_map in Target.cpp.
@@ -157,8 +157,8 @@ struct Target {
157157
FeatureEnd = halide_target_feature_end
158158
};
159159
Target() = default;
160-
Target(OS o, Arch a, int b, Processor p, const std::vector<Feature> &initial_features = std::vector<Feature>())
161-
: os(o), arch(a), bits(b), processor(p) {
160+
Target(OS o, Arch a, int b, Processor pt, const std::vector<Feature> &initial_features = std::vector<Feature>())
161+
: os(o), arch(a), bits(b), processor_tune(pt) {
162162
for (const auto &f : initial_features) {
163163
set_feature(f);
164164
}
@@ -251,7 +251,7 @@ struct Target {
251251
return os == other.os &&
252252
arch == other.arch &&
253253
bits == other.bits &&
254-
processor == other.processor &&
254+
processor_tune == other.processor_tune &&
255255
features == other.features;
256256
}
257257

0 commit comments

Comments
 (0)