-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #373 from ValeevGroup/evaleev/feature/tensor-memor…
…y-profile-and-trace Evaleev/feature/tensor memory profile and trace
- Loading branch information
Showing
16 changed files
with
157 additions
and
129 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# see https://stackoverflow.com/a/69952705 and https://gitlab.kitware.com/cmake/cmake/-/blob/master/Modules/CMakeDetermineCompilerABI.cmake | ||
|
||
set(BIN "${CMAKE_PLATFORM_INFO_DIR}/cmake/modules/DetectAlignSize.bin") | ||
try_compile(DETECT_ALIGN_SIZE_COMPILED | ||
${CMAKE_BINARY_DIR} | ||
SOURCES ${PROJECT_SOURCE_DIR}/cmake/modules/DetectAlignSize.cpp | ||
CMAKE_FLAGS ${CMAKE_CXX_FLAGS} | ||
COPY_FILE "${BIN}" | ||
COPY_FILE_ERROR copy_error | ||
OUTPUT_VARIABLE OUTPUT | ||
) | ||
if (DETECT_ALIGN_SIZE_COMPILED AND NOT copy_error) | ||
file(STRINGS "${BIN}" data REGEX "INFO:align_size\\[[^]]*\\]") | ||
if (data MATCHES "INFO:align_size\\[0*([^]]*)\\]") | ||
set(TA_ALIGN_SIZE_DETECTED "${CMAKE_MATCH_1}" CACHE INTERNAL "") | ||
endif() | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// | ||
// Created by Eduard Valeyev on 10/18/22. | ||
// | ||
|
||
#if defined(__x86_64__) | ||
#if defined(__AVX__) | ||
#define PREFERRED_ALIGN_SIZE 32 | ||
#elif defined(__AVX512F__) | ||
#define PREFERRED_ALIGN_SIZE 64 | ||
#else // 64-bit x86 should have SSE | ||
#define PREFERRED_ALIGN_SIZE 16 | ||
#endif | ||
#elif (defined(__ARM_NEON__) || defined(__aarch64__) || defined(_M_ARM) || \ | ||
defined(_M_ARM64)) | ||
#define PREFERRED_ALIGN_SIZE 16 | ||
#elif defined(__VECTOR4DOUBLE__) | ||
#define PREFERRED_ALIGN_SIZE 32 | ||
#endif | ||
|
||
// else: default to typical cache line size | ||
#ifndef PREFERRED_ALIGN_SIZE | ||
#define PREFERRED_ALIGN_SIZE 64 | ||
#endif | ||
|
||
/* Preferred align size, in bytes. */ | ||
const char info_align_size[] = { | ||
/* clang-format off */ | ||
'I', 'N', 'F', 'O', ':', 'a', 'l', 'i', 'g', 'n', '_', 's', 'i', 'z', | ||
'e', '[', ('0' + ((PREFERRED_ALIGN_SIZE / 10) % 10)), ('0' + (PREFERRED_ALIGN_SIZE % 10)), ']', | ||
'\0' | ||
/* clang-format on */ | ||
}; | ||
|
||
int main(int argc, char* argv[]) { | ||
int require = 0; | ||
require += info_align_size[argc]; | ||
(void)argv; | ||
return require; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.