Skip to content

Commit 2196da3

Browse files
[SYCL] Removes any knowledge of specific memory advices from PI API. (#2607)
Signed-off-by: Sergey V Maslov <[email protected]>
1 parent 2939b92 commit 2196da3

File tree

3 files changed

+5
-50
lines changed

3 files changed

+5
-50
lines changed

sycl/include/CL/sycl/detail/pi.h

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -389,24 +389,8 @@ typedef enum {
389389
} _pi_mem_type;
390390

391391
typedef enum {
392-
PI_MEM_ADVICE_SET_READ_MOSTLY = 0, ///< hints that memory will be read from
393-
///< frequently and written to rarely
394-
PI_MEM_ADVICE_CLEAR_READ_MOSTLY, ///< removes the affect of
395-
///< PI_MEM_ADVICE_SET_READ_MOSTLY
396-
PI_MEM_ADVICE_SET_PREFERRED_LOCATION, ///< hints that the preferred memory
397-
///< location is the specified device
398-
PI_MEM_ADVICE_CLEAR_PREFERRED_LOCATION, ///< removes the affect of
399-
///< PI_MEM_ADVICE_SET_PREFERRED_LOCATION
400-
PI_MEM_ADVICE_SET_ACCESSED_BY, ///< hints that memory will be accessed by the
401-
///< specified device
402-
PI_MEM_ADVICE_CLEAR_ACCESSED_BY, ///< removes the affect of
403-
///< PI_MEM_ADVICE_SET_ACCESSED_BY
404-
PI_MEM_ADVICE_SET_NON_ATOMIC_MOSTLY, ///< hints that memory will mostly be
405-
///< accessed non-atomically
406-
PI_MEM_ADVICE_CLEAR_NON_ATOMIC_MOSTLY, ///< removes the affect of
407-
///< PI_MEM_ADVICE_SET_NON_ATOMIC_MOSTLY
408-
PI_MEM_ADVICE_BIAS_CACHED, ///< hints that memory should be cached
409-
PI_MEM_ADVICE_BIAS_UNCACHED ///< hints that memory should not be cached
392+
// Device-specific value opaque in PI API.
393+
PI_MEM_ADVISE_UNKNOWN
410394
} _pi_mem_advice;
411395

412396
typedef enum {

sycl/plugins/level_zero/pi_level_zero.cpp

100644100755
Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -4794,36 +4794,7 @@ pi_result piextUSMEnqueueMemAdvise(pi_queue Queue, const void *Ptr,
47944794
// Lock automatically releases when this goes out of scope.
47954795
std::lock_guard<std::mutex> lock(Queue->PiQueueMutex);
47964796

4797-
ze_memory_advice_t ZeAdvice = {};
4798-
switch (Advice) {
4799-
case PI_MEM_ADVICE_SET_READ_MOSTLY:
4800-
ZeAdvice = ZE_MEMORY_ADVICE_SET_READ_MOSTLY;
4801-
break;
4802-
case PI_MEM_ADVICE_CLEAR_READ_MOSTLY:
4803-
ZeAdvice = ZE_MEMORY_ADVICE_CLEAR_READ_MOSTLY;
4804-
break;
4805-
case PI_MEM_ADVICE_SET_PREFERRED_LOCATION:
4806-
ZeAdvice = ZE_MEMORY_ADVICE_SET_PREFERRED_LOCATION;
4807-
break;
4808-
case PI_MEM_ADVICE_CLEAR_PREFERRED_LOCATION:
4809-
ZeAdvice = ZE_MEMORY_ADVICE_CLEAR_PREFERRED_LOCATION;
4810-
break;
4811-
case PI_MEM_ADVICE_SET_NON_ATOMIC_MOSTLY:
4812-
ZeAdvice = ZE_MEMORY_ADVICE_SET_NON_ATOMIC_MOSTLY;
4813-
break;
4814-
case PI_MEM_ADVICE_CLEAR_NON_ATOMIC_MOSTLY:
4815-
ZeAdvice = ZE_MEMORY_ADVICE_CLEAR_NON_ATOMIC_MOSTLY;
4816-
break;
4817-
case PI_MEM_ADVICE_BIAS_CACHED:
4818-
ZeAdvice = ZE_MEMORY_ADVICE_BIAS_CACHED;
4819-
break;
4820-
case PI_MEM_ADVICE_BIAS_UNCACHED:
4821-
ZeAdvice = ZE_MEMORY_ADVICE_BIAS_UNCACHED;
4822-
break;
4823-
default:
4824-
zePrint("piextUSMEnqueueMemAdvise: unexpected memory advise\n");
4825-
return PI_INVALID_VALUE;
4826-
}
4797+
auto ZeAdvice = pi_cast<ze_memory_advice_t>(Advice);
48274798

48284799
// Get a new command list to be used on this call
48294800
ze_command_list_handle_t ZeCommandList = nullptr;

sycl/test/usm/memadvise.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ int main() {
3636
if (s_head == nullptr) {
3737
return -1;
3838
}
39-
q.mem_advise(s_head, sizeof(Node), PI_MEM_ADVICE_SET_READ_MOSTLY);
39+
q.mem_advise(s_head, sizeof(Node), (pi_mem_advice)0);
4040
Node *s_cur = s_head;
4141

4242
for (int i = 0; i < numNodes; i++) {
@@ -47,7 +47,7 @@ int main() {
4747
if (s_cur->pNext == nullptr) {
4848
return -1;
4949
}
50-
q.mem_advise(s_cur->pNext, sizeof(Node), PI_MEM_ADVICE_SET_READ_MOSTLY);
50+
q.mem_advise(s_cur->pNext, sizeof(Node), (pi_mem_advice)0);
5151
} else {
5252
s_cur->pNext = nullptr;
5353
}

0 commit comments

Comments
 (0)