Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
snnn committed Feb 1, 2024
1 parent 38017cb commit f2cd258
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
11 changes: 4 additions & 7 deletions onnxruntime/core/platform/windows/hardware_core_enumerator.cc
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright (c) Microsoft Corporation. All rights reserved.

Check warning on line 1 in onnxruntime/core/platform/windows/hardware_core_enumerator.cc

View workflow job for this annotation

GitHub Actions / Lint C++

[cpplint] reported by reviewdog 🐶 At least two spaces is best between code and comments [whitespace/comments] [2] Raw Output: onnxruntime/core/platform/windows/hardware_core_enumerator.cc:1: At least two spaces is best between code and comments [whitespace/comments] [2]
// Licensed under the MIT License.


#include "hardware_core_enumerator.h"

Check warning on line 4 in onnxruntime/core/platform/windows/hardware_core_enumerator.cc

View workflow job for this annotation

GitHub Actions / Lint C++

[cpplint] reported by reviewdog 🐶 Include the directory when naming header files [build/include_subdir] [4] Raw Output: onnxruntime/core/platform/windows/hardware_core_enumerator.cc:4: Include the directory when naming header files [build/include_subdir] [4]
#include <memory>
#include <Windows.h>
Expand All @@ -28,8 +27,7 @@ static LogicalProcessorInformation GetLogicalProcessorInfos(LOGICAL_PROCESSOR_RE
auto processorInformationBytes = std::make_unique<char[]>(length);

rc = GetLogicalProcessorInformationEx(
relationship, reinterpret_cast<PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX>(processorInformationBytes.get()), &length
);
relationship, reinterpret_cast<PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX>(processorInformationBytes.get()), &length);

Check warning on line 30 in onnxruntime/core/platform/windows/hardware_core_enumerator.cc

View workflow job for this annotation

GitHub Actions / Lint C++

[cpplint] reported by reviewdog 🐶 Lines should be <= 120 characters long [whitespace/line_length] [2] Raw Output: onnxruntime/core/platform/windows/hardware_core_enumerator.cc:30: Lines should be <= 120 characters long [whitespace/line_length] [2]

assert(rc == TRUE);

Expand All @@ -53,10 +51,9 @@ static CoreCounter GetNumberOPhysicalAndEngineeringCores() {
size_t read = 0;
PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX currentProcessorInfo = NULL;

while ((read + FIELD_OFFSET(SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX, Processor)) < logicalProcessorInformation.Length
) {
while ((read + FIELD_OFFSET(SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX, Processor)) < logicalProcessorInformation.Length) {

Check warning on line 54 in onnxruntime/core/platform/windows/hardware_core_enumerator.cc

View workflow job for this annotation

GitHub Actions / Lint C++

[cpplint] reported by reviewdog 🐶 Lines should be <= 120 characters long [whitespace/line_length] [2] Raw Output: onnxruntime/core/platform/windows/hardware_core_enumerator.cc:54: Lines should be <= 120 characters long [whitespace/line_length] [2]
currentProcessorInfo =
reinterpret_cast<PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX>(logicalProcessorInformation.Buffer.get() + read);
reinterpret_cast<PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX>(logicalProcessorInformation.Buffer.get() + read);
if ((read + currentProcessorInfo->Size) > logicalProcessorInformation.Length) {
break;
}
Expand Down Expand Up @@ -89,4 +86,4 @@ uint32_t HardwareCoreEnumerator::DefaultIntraOpNumThreads() {
return cores.PhysicalCores - cores.SocDieCores;
}

}
} // namespace onnxruntime
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ struct HardwareCoreEnumerator {
HardwareCoreEnumerator() = delete;
static uint32_t DefaultIntraOpNumThreads();
};
}
} // namespace onnxruntime

Check warning on line 12 in onnxruntime/core/platform/windows/hardware_core_enumerator.h

View workflow job for this annotation

GitHub Actions / Lint C++

[cpplint] reported by reviewdog 🐶 Could not find a newline character at the end of the file. [whitespace/ending_newline] [5] Raw Output: onnxruntime/core/platform/windows/hardware_core_enumerator.h:12: Could not find a newline character at the end of the file. [whitespace/ending_newline] [5]

0 comments on commit f2cd258

Please sign in to comment.