Changeset View
Changeset View
Standalone View
Standalone View
openmp/libomptarget/src/rtl.cpp
Show First 20 Lines • Show All 284 Lines • ▼ Show 20 Lines | void RTLsTy::RegisterRequires(int64_t flags) { | ||||||||||||||||
} | } | ||||||||||||||||
// TODO: insert any other missing checks | // TODO: insert any other missing checks | ||||||||||||||||
DP("New requires flags %" PRId64 " compatible with existing %" PRId64 "!\n", | DP("New requires flags %" PRId64 " compatible with existing %" PRId64 "!\n", | ||||||||||||||||
flags, RequiresFlags); | flags, RequiresFlags); | ||||||||||||||||
} | } | ||||||||||||||||
void RTLsTy::RegisterLib(__tgt_bin_desc *desc) { | void RTLsTy::initRTLonce(RTLInfoTy &R) { | ||||||||||||||||
PM->RTLsMtx.lock(); | |||||||||||||||||
// Register the images with the RTLs that understand them, if any. | |||||||||||||||||
for (int32_t i = 0; i < desc->NumDeviceImages; ++i) { | |||||||||||||||||
// Obtain the image. | |||||||||||||||||
__tgt_device_image *img = &desc->DeviceImages[i]; | |||||||||||||||||
RTLInfoTy *FoundRTL = NULL; | |||||||||||||||||
// Scan the RTLs that have associated images until we find one that supports | |||||||||||||||||
// the current image. | |||||||||||||||||
for (auto &R : AllRTLs) { | |||||||||||||||||
if (!R.is_valid_binary(img)) { | |||||||||||||||||
DP("Image " DPxMOD " is NOT compatible with RTL %s!\n", | |||||||||||||||||
DPxPTR(img->ImageStart), R.RTLName.c_str()); | |||||||||||||||||
continue; | |||||||||||||||||
} | |||||||||||||||||
DP("Image " DPxMOD " is compatible with RTL %s!\n", | |||||||||||||||||
DPxPTR(img->ImageStart), R.RTLName.c_str()); | |||||||||||||||||
// If this RTL is not already in use, initialize it. | // If this RTL is not already in use, initialize it. | ||||||||||||||||
if (!R.isUsed) { | if (!R.isUsed && R.NumberOfDevices != 0) { | ||||||||||||||||
Lint: Pre-merge checks: clang-tidy: warning: invalid case style for variable 'device' [readability-identifier-naming]… | |||||||||||||||||
// Initialize the device information for the RTL we are about to use. | // Initialize the device information for the RTL we are about to use. | ||||||||||||||||
DeviceTy device(&R); | DeviceTy device(&R); | ||||||||||||||||
size_t Start = PM->Devices.size(); | size_t Start = PM->Devices.size(); | ||||||||||||||||
Lint: Pre-merge checks clang-tidy: warning: invalid case style for variable 'device_id' [readability-identifier-naming] Lint: Pre-merge checks: clang-tidy: warning: invalid case style for variable 'device_id' [readability-identifier… | |||||||||||||||||
PM->Devices.resize(Start + R.NumberOfDevices, device); | PM->Devices.resize(Start + R.NumberOfDevices, device); | ||||||||||||||||
for (int32_t device_id = 0; device_id < R.NumberOfDevices; | for (int32_t device_id = 0; device_id < R.NumberOfDevices; device_id++) { | ||||||||||||||||
device_id++) { | |||||||||||||||||
// global device ID | // global device ID | ||||||||||||||||
PM->Devices[Start + device_id].DeviceID = Start + device_id; | PM->Devices[Start + device_id].DeviceID = Start + device_id; | ||||||||||||||||
// RTL local device ID | // RTL local device ID | ||||||||||||||||
PM->Devices[Start + device_id].RTLDeviceID = device_id; | PM->Devices[Start + device_id].RTLDeviceID = device_id; | ||||||||||||||||
} | } | ||||||||||||||||
// Initialize the index of this RTL and save it in the used RTLs. | // Initialize the index of this RTL and save it in the used RTLs. | ||||||||||||||||
R.Idx = (UsedRTLs.empty()) | R.Idx = (UsedRTLs.empty()) | ||||||||||||||||
? 0 | ? 0 | ||||||||||||||||
: UsedRTLs.back()->Idx + UsedRTLs.back()->NumberOfDevices; | : UsedRTLs.back()->Idx + UsedRTLs.back()->NumberOfDevices; | ||||||||||||||||
assert((size_t)R.Idx == Start && | assert((size_t)R.Idx == Start && | ||||||||||||||||
"RTL index should equal the number of devices used so far."); | "RTL index should equal the number of devices used so far."); | ||||||||||||||||
R.isUsed = true; | R.isUsed = true; | ||||||||||||||||
UsedRTLs.push_back(&R); | UsedRTLs.push_back(&R); | ||||||||||||||||
DP("RTL " DPxMOD " has index %d!\n", DPxPTR(R.LibraryHandler), R.Idx); | DP("RTL " DPxMOD " has index %d!\n", DPxPTR(R.LibraryHandler), R.Idx); | ||||||||||||||||
} | } | ||||||||||||||||
} | |||||||||||||||||
void RTLsTy::initAllRTLs() { | |||||||||||||||||
for (auto &R : AllRTLs) { | |||||||||||||||||
initRTLonce(R); | |||||||||||||||||
} | |||||||||||||||||
} | |||||||||||||||||
tianshilei1992Unsubmitted
tianshilei1992: | |||||||||||||||||
void RTLsTy::RegisterLib(__tgt_bin_desc *desc) { | |||||||||||||||||
PM->RTLsMtx.lock(); | |||||||||||||||||
// Register the images with the RTLs that understand them, if any. | |||||||||||||||||
for (int32_t i = 0; i < desc->NumDeviceImages; ++i) { | |||||||||||||||||
// Obtain the image. | |||||||||||||||||
__tgt_device_image *img = &desc->DeviceImages[i]; | |||||||||||||||||
RTLInfoTy *FoundRTL = NULL; | |||||||||||||||||
tianshilei1992Unsubmitted
tianshilei1992: | |||||||||||||||||
// Scan the RTLs that have associated images until we find one that supports | |||||||||||||||||
// the current image. | |||||||||||||||||
for (auto &R : AllRTLs) { | |||||||||||||||||
if (!R.is_valid_binary(img)) { | |||||||||||||||||
DP("Image " DPxMOD " is NOT compatible with RTL %s!\n", | |||||||||||||||||
DPxPTR(img->ImageStart), R.RTLName.c_str()); | |||||||||||||||||
continue; | |||||||||||||||||
} | |||||||||||||||||
DP("Image " DPxMOD " is compatible with RTL %s!\n", | |||||||||||||||||
DPxPTR(img->ImageStart), R.RTLName.c_str()); | |||||||||||||||||
initRTLonce(R); | |||||||||||||||||
// Initialize (if necessary) translation table for this library. | // Initialize (if necessary) translation table for this library. | ||||||||||||||||
PM->TrlTblMtx.lock(); | PM->TrlTblMtx.lock(); | ||||||||||||||||
if (!PM->HostEntriesBeginToTransTable.count(desc->HostEntriesBegin)) { | if (!PM->HostEntriesBeginToTransTable.count(desc->HostEntriesBegin)) { | ||||||||||||||||
PM->HostEntriesBeginRegistrationOrder.push_back(desc->HostEntriesBegin); | PM->HostEntriesBeginRegistrationOrder.push_back(desc->HostEntriesBegin); | ||||||||||||||||
TranslationTable &TransTable = | TranslationTable &TransTable = | ||||||||||||||||
(PM->HostEntriesBeginToTransTable)[desc->HostEntriesBegin]; | (PM->HostEntriesBeginToTransTable)[desc->HostEntriesBegin]; | ||||||||||||||||
TransTable.HostTable.EntriesBegin = desc->HostEntriesBegin; | TransTable.HostTable.EntriesBegin = desc->HostEntriesBegin; | ||||||||||||||||
▲ Show 20 Lines • Show All 123 Lines • Show Last 20 Lines |
clang-tidy: warning: invalid case style for variable 'device' [readability-identifier-naming]
not useful