Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,9 @@ std::string loadNicPriorityMatrix() {
" \"cpu:1\": [[" +
device_names +
"], []], "
" \"npu:0\": [[" +
device_names +
"], []], "
" \"cuda:0\": [[" +
device_names +
"], []], "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,19 @@
namespace mooncake {

namespace {
// ACL memory location types for aclrtPtrAttributes::location.type:
// 0 = ACL host memory, 1 = device memory, 2 = regular CPU memory (malloc)
static constexpr int kDeviceMemoryLocationType = 1;

bool isCpuMemory(void *addr) {
aclrtPtrAttributes attributes{};
if (int ret = aclrtPointerGetAttributes(addr, &attributes)) {
LOG(ERROR) << "aclrtPointrtGetAttributes error, ret: " << ret;
return false;
// If ACL cannot identify the pointer, treat it as regular CPU memory.
LOG(WARNING) << "aclrtPointerGetAttributes failed for addr " << addr
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reformat the example file string concatenation

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

<< ", ret: " << ret << ". Treating as CPU memory.";
return true;
}
return (attributes.location.type == 0);
return (attributes.location.type != kDeviceMemoryLocationType);
}
} // namespace

Expand Down
Loading