Skip to content

Commit f04fef7

Browse files
committed
Remove link copy queues
1 parent 40f2626 commit f04fef7

File tree

2 files changed

+2
-97
lines changed

2 files changed

+2
-97
lines changed

offload/plugins-nextgen/level_zero/include/L0Device.h

Lines changed: 2 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -84,18 +84,12 @@ class L0DeviceTLSTy {
8484
/// Main copy command list for each device
8585
ze_command_list_handle_t CopyCmdList = nullptr;
8686

87-
/// Link copy command list for each device
88-
ze_command_list_handle_t LinkCopyCmdList = nullptr;
89-
9087
/// Command queue for each device
9188
ze_command_queue_handle_t CmdQueue = nullptr;
9289

9390
/// Main copy command queue for each device
9491
ze_command_queue_handle_t CopyCmdQueue = nullptr;
9592

96-
/// Link copy command queues for each device
97-
ze_command_queue_handle_t LinkCopyCmdQueue = nullptr;
98-
9993
/// Immediate command list for each device
10094
ze_command_list_handle_t ImmCmdList = nullptr;
10195

@@ -106,20 +100,17 @@ class L0DeviceTLSTy {
106100
L0DeviceTLSTy() = default;
107101
~L0DeviceTLSTy() {
108102
// assert all fields are nullptr on destruction
109-
assert(!CmdList && !CopyCmdList && !LinkCopyCmdList && !CmdQueue &&
110-
!CopyCmdQueue && !LinkCopyCmdQueue && !ImmCmdList &&
111-
!ImmCopyCmdList &&
103+
assert(!CmdList && !CopyCmdList && !CmdQueue && !CopyCmdQueue &&
104+
!ImmCmdList && !ImmCopyCmdList &&
112105
"L0DeviceTLSTy destroyed without clearing resources");
113106
}
114107

115108
L0DeviceTLSTy(const L0DeviceTLSTy &) = delete;
116109
L0DeviceTLSTy(L0DeviceTLSTy &&Other) {
117110
CmdList = std::exchange(Other.CmdList, nullptr);
118111
CopyCmdList = std::exchange(Other.CopyCmdList, nullptr);
119-
LinkCopyCmdList = std::exchange(Other.LinkCopyCmdList, nullptr);
120112
CmdQueue = std::exchange(Other.CmdQueue, nullptr);
121113
CopyCmdQueue = std::exchange(Other.CopyCmdQueue, nullptr);
122-
LinkCopyCmdQueue = std::exchange(Other.LinkCopyCmdQueue, nullptr);
123114
ImmCmdList = std::exchange(Other.ImmCmdList, nullptr);
124115
ImmCopyCmdList = std::exchange(Other.ImmCopyCmdList, nullptr);
125116
}
@@ -130,8 +121,6 @@ class L0DeviceTLSTy {
130121
CALL_ZE_EXIT_FAIL(zeCommandListDestroy, CmdList);
131122
if (CopyCmdList)
132123
CALL_ZE_EXIT_FAIL(zeCommandListDestroy, CopyCmdList);
133-
if (LinkCopyCmdList)
134-
CALL_ZE_EXIT_FAIL(zeCommandListDestroy, LinkCopyCmdList);
135124
if (ImmCmdList)
136125
CALL_ZE_EXIT_FAIL(zeCommandListDestroy, ImmCmdList);
137126
if (ImmCopyCmdList)
@@ -140,15 +129,11 @@ class L0DeviceTLSTy {
140129
CALL_ZE_EXIT_FAIL(zeCommandQueueDestroy, CmdQueue);
141130
if (CopyCmdQueue)
142131
CALL_ZE_EXIT_FAIL(zeCommandQueueDestroy, CopyCmdQueue);
143-
if (LinkCopyCmdQueue)
144-
CALL_ZE_EXIT_FAIL(zeCommandQueueDestroy, LinkCopyCmdQueue);
145132

146133
CmdList = nullptr;
147134
CopyCmdList = nullptr;
148-
LinkCopyCmdList = nullptr;
149135
CmdQueue = nullptr;
150136
CopyCmdQueue = nullptr;
151-
LinkCopyCmdQueue = nullptr;
152137
ImmCmdList = nullptr;
153138
ImmCopyCmdList = nullptr;
154139
}
@@ -164,13 +149,6 @@ class L0DeviceTLSTy {
164149
CopyCmdList = _CopyCmdList;
165150
}
166151

167-
ze_command_list_handle_t getLinkCopyCmdList() const {
168-
return LinkCopyCmdList;
169-
}
170-
void setLinkCopyCmdList(ze_command_list_handle_t _LinkCopyCmdList) {
171-
LinkCopyCmdList = _LinkCopyCmdList;
172-
}
173-
174152
ze_command_list_handle_t getImmCmdList() const { return ImmCmdList; }
175153
void setImmCmdList(ze_command_list_handle_t ImmCmdListIn) {
176154
ImmCmdList = ImmCmdListIn;
@@ -190,13 +168,6 @@ class L0DeviceTLSTy {
190168
void setCopyCmdQueue(ze_command_queue_handle_t CopyCmdQueueIn) {
191169
CopyCmdQueue = CopyCmdQueueIn;
192170
}
193-
194-
ze_command_queue_handle_t getLinkCopyCmdQueue() const {
195-
return LinkCopyCmdQueue;
196-
}
197-
void setLinkCopyCmdQueue(ze_command_queue_handle_t LinkCopyCmdQueueIn) {
198-
LinkCopyCmdQueue = LinkCopyCmdQueueIn;
199-
}
200171
};
201172

202173
struct L0DeviceTLSTableTy
@@ -238,8 +209,6 @@ class L0DeviceTy final : public GenericDeviceTy {
238209
std::pair<uint32_t, uint32_t> ComputeOrdinal{UINT32_MAX, 0};
239210
/// Command queue group ordinals for copying
240211
std::pair<uint32_t, uint32_t> CopyOrdinal{UINT32_MAX, 0};
241-
/// Command queue group ordinals and number of queues for link copy engines
242-
std::pair<uint32_t, uint32_t> LinkCopyOrdinal{UINT32_MAX, 0};
243212

244213
/// Command queue index for each device
245214
uint32_t ComputeIndex = 0;
@@ -416,10 +385,6 @@ class L0DeviceTy final : public GenericDeviceTy {
416385
bool hasMainCopyEngine() const { return CopyOrdinal.first != UINT32_MAX; }
417386
uint32_t getMainCopyEngine() const { return CopyOrdinal.first; }
418387

419-
uint32_t getLinkCopyEngine() const { return LinkCopyOrdinal.first; }
420-
uint32_t getNumLinkCopyQueues() const { return LinkCopyOrdinal.second; }
421-
bool hasLinkCopyEngine() const { return getNumLinkCopyQueues() > 0; }
422-
423388
bool deviceRequiresImmCmdList() const {
424389
return isDeviceIPorNewer(0x05004000);
425390
}
@@ -474,8 +439,6 @@ class L0DeviceTy final : public GenericDeviceTy {
474439
Expected<ze_command_queue_handle_t> getCmdQueue();
475440
Expected<ze_command_list_handle_t> getCopyCmdList();
476441
Expected<ze_command_queue_handle_t> getCopyCmdQueue();
477-
Expected<ze_command_list_handle_t> getLinkCopyCmdList();
478-
Expected<ze_command_queue_handle_t> getLinkCopyCmdQueue();
479442
Expected<ze_command_list_handle_t> getImmCmdList();
480443
Expected<ze_command_list_handle_t> getImmCopyCmdList();
481444

offload/plugins-nextgen/level_zero/src/L0Device.cpp

Lines changed: 0 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,6 @@ Error L0DeviceTy::initImpl(GenericPluginTy &Plugin) {
211211

212212
CopyOrdinal = findCopyOrdinal();
213213

214-
LinkCopyOrdinal = findCopyOrdinal(true);
215214
IsAsyncEnabled =
216215
isDiscreteDevice() && Options.CommandMode != CommandModeTy::Sync;
217216
if (auto Err = MemAllocator.initDevicePools(*this, getPlugin().getOptions()))
@@ -945,8 +944,6 @@ L0DeviceTy::createImmCmdList(uint32_t Ordinal, uint32_t Index, bool InOrder) {
945944
/// Create an immediate command list for copying
946945
Expected<ze_command_list_handle_t> L0DeviceTy::createImmCopyCmdList() {
947946
uint32_t Ordinal = getMainCopyEngine();
948-
if (Ordinal == UINT32_MAX)
949-
Ordinal = getLinkCopyEngine();
950947
if (Ordinal == UINT32_MAX)
951948
Ordinal = getComputeEngine();
952949
return createImmCmdList(Ordinal, /*Index*/ 0);
@@ -980,9 +977,6 @@ Expected<ze_command_list_handle_t> L0DeviceTy::getCopyCmdList() {
980977
}
981978
return CmdList;
982979
}
983-
// Use link copy engine if available
984-
if (hasLinkCopyEngine())
985-
return getLinkCopyCmdList();
986980
// Use compute engine otherwise
987981
return getCmdList();
988982
}
@@ -1002,58 +996,6 @@ Expected<ze_command_queue_handle_t> L0DeviceTy::getCopyCmdQueue() {
1002996
}
1003997
return CmdQueue;
1004998
}
1005-
// Use link copy engine if available
1006-
if (hasLinkCopyEngine())
1007-
return getLinkCopyCmdQueue();
1008-
// Use compute engine otherwise
1009-
return getCmdQueue();
1010-
}
1011-
1012-
Expected<ze_command_list_handle_t> L0DeviceTy::getLinkCopyCmdList() {
1013-
// Use link copy engine if available
1014-
if (hasLinkCopyEngine()) {
1015-
auto &TLS = getTLS();
1016-
auto CmdList = TLS.getLinkCopyCmdList();
1017-
if (!CmdList) {
1018-
auto CmdListOrErr =
1019-
createCmdList(getZeContext(), getZeDevice(), getLinkCopyEngine(),
1020-
ZE_COMMAND_LIST_FLAG_EXPLICIT_ONLY, getZeId());
1021-
if (!CmdListOrErr)
1022-
return CmdListOrErr.takeError();
1023-
CmdList = *CmdListOrErr;
1024-
TLS.setLinkCopyCmdList(CmdList);
1025-
}
1026-
return CmdList;
1027-
}
1028-
// Use main copy engine if available
1029-
if (hasMainCopyEngine())
1030-
return getCopyCmdList();
1031-
// Use compute engine otherwise
1032-
return getCmdList();
1033-
}
1034-
1035-
Expected<ze_command_queue_handle_t> L0DeviceTy::getLinkCopyCmdQueue() {
1036-
// Use link copy engine if available
1037-
if (hasLinkCopyEngine()) {
1038-
auto &TLS = getTLS();
1039-
auto CmdQueue = TLS.getLinkCopyCmdQueue();
1040-
if (!CmdQueue) {
1041-
// Try to use different copy engines for multiple threads
1042-
uint32_t Index =
1043-
__kmpc_global_thread_num(nullptr) % getNumLinkCopyQueues();
1044-
auto CmdQueueOrErr =
1045-
createCmdQueue(getZeContext(), getZeDevice(), getLinkCopyEngine(),
1046-
Index, ZE_COMMAND_QUEUE_FLAG_EXPLICIT_ONLY, getZeId());
1047-
if (!CmdQueueOrErr)
1048-
return CmdQueueOrErr.takeError();
1049-
CmdQueue = *CmdQueueOrErr;
1050-
TLS.setLinkCopyCmdQueue(CmdQueue);
1051-
}
1052-
return CmdQueue;
1053-
}
1054-
// Use main copy engine if available
1055-
if (hasMainCopyEngine())
1056-
return getCopyCmdQueue();
1057999
// Use compute engine otherwise
10581000
return getCmdQueue();
10591001
}

0 commit comments

Comments
 (0)