szha commented on a change in pull request #20412:
URL: https://github.com/apache/incubator-mxnet/pull/20412#discussion_r743909951



##########
File path: src/common/utils.h
##########
@@ -983,9 +986,21 @@ inline bool AlignedMemAlloc(void** ptr, size_t size, 
size_t alignment) {
   if (*ptr == nullptr)
     return false;
 #else
-  int res = posix_memalign(ptr, alignment, size);
-  if (res != 0)
+  int res                       = posix_memalign(ptr, alignment, size);
+#if __linux__
+  constexpr size_t gHugePage2MB = 1 << 21;
+  if (size >= gHugePage2MB) {
+    // TODO(mozga-intel): Enable MacOS Huge Pages if desired
+    res = posix_memalign(ptr, gHugePage2MB, size);
+    if (res == 0) {

Review comment:
       on linux the `posix_memalign` would be called twice. intentional?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to