Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

i#1312 AVX-512 support: Add code cache enter/return context switching. #3738

Merged
merged 32 commits into from
Jul 20, 2019

Conversation

hgreving2304
Copy link

@hgreving2304 hgreving2304 commented Jul 17, 2019

Adds support for dynamic AVX-512 context switching to/from the code cache. DynamoRIO now
saves and restores the AVX-512 context once AVX-512 has been detected in the application.
The latter is called lazy context switching in DynamoRIO. Mask registers are saved with
respect to their width dependent on the AVX-512BW feature support of the processor.

Adds the internal function proc_set_num_simd_saved() used to change the number of saved
SIMD registers that is also returned by proc_num_simd_saved().

Adds the internal function move_mm_avx512_reg_opcode() that is intentionally distinct from
move_mm_reg_opcode(), because its uses are distinct as well.

Renames FEATURE_AVX512 to FEATURE_AVX512F and adds FEATURE_AVX512BW. In the same
context, renames OPMASK_REG_SIZE to OPMASK_AVX512BW_REG_SIZE and adds
OPMASK_AVX512F_REG_SIZE. Both changes reflect the different mask register width dependent
on the AVX-512BW processor feature. DynamoRIO reserves enough space by default for the
wider variant, but different kmov[wq] instructions are used to read and write mask
registers.

For x86, saving SIMD registers during a code-cache context switch has been moved after
saving the flags, because saving SIMD now adds control flow. The same applies to restoring
the SIMD registers, respectively.

Moves the global variable d_r_avx512_code_in_use to reachable heap.

Adds an ATOMIC_1BYTE_WRITE() macro.

Adds a per-thread LOG entry when AVX-512 detection occurs.

Adds an AVX-512 test for above. The test also works in 32-bit mode.

Issue: #1312

Hendrik Greving added 2 commits July 17, 2019 14:22
Adds support for dynamic AVX-512 context switching to/from the code cache. DynamoRIO now
saves and restores the AVX-512 context once AVX-512 has been detected in the application.
The latter is called lazy context switching in DynamoRIO. Mask registers are saved with
respect to their width dependent on the AVX-512BW feature support of the processor.

Adds the internal function proc_set_num_simd_saved() used to change the number of saved
SIMD registers that is also returned by proc_num_simd_saved().

Adds the internal function move_mm_avx512_reg_opcode() that is intentionally distinct from
move_mm_reg_opcode(), because its uses are distinct as well.

Renames FEATURE_AVX512 to FEATURE_AVX512F and adds FEATURE_AVX512BW. In the same
context, renames OPMASK_REG_SIZE to OPMASK_AVX512BW_REG_SIZE and adds
OPMASK_AVX512F_REG_SIZE. Both changes reflect the different mask register width dependent
on the AVX-512BW processor feature. DynamoRIO reserves enough space by default for the
wider variant, but different kmov[wq] instructions are used to read and write mask
registers.

For x86, saving SIMD registers during a code-cache context switch has been moved after
saving the flags, because saving SIMD now adds control flow. The same applies to restoring
the SIMD registers, respectively.

Adds a per-thread LOG entry when AVX-512 detection occurs.

Adds an AVX-512 test for above. The test also works in 32-bit mode.

Issue: #1312
core/arch/aarch64/proc.c Show resolved Hide resolved
core/arch/aarch64/proc.c Outdated Show resolved Hide resolved
core/arch/aarch64/proc.c Outdated Show resolved Hide resolved
core/arch/arch.h Outdated Show resolved Hide resolved
core/arch/emit_utils_shared.c Outdated Show resolved Hide resolved
suite/tests/client-interface/avx512ctx.c Outdated Show resolved Hide resolved
suite/tests/client-interface/avx512ctx.c Outdated Show resolved Hide resolved
suite/tests/client-interface/avx512ctx.c Outdated Show resolved Hide resolved
suite/tests/client-interface/avx512ctx.c Outdated Show resolved Hide resolved
suite/tests/client-interface/avx512ctx.dll.c Outdated Show resolved Hide resolved
@hgreving2304 hgreving2304 changed the title i#1312 AVX-512 support: Add code cache to/from context switching. i#1312 AVX-512 support: Add code cache enter/return context switching. Jul 18, 2019
core/arch/aarch64/proc.c Show resolved Hide resolved
core/arch/aarch64/proc.c Outdated Show resolved Hide resolved
core/arch/arch.c Outdated Show resolved Hide resolved
core/arch/arch.c Outdated Show resolved Hide resolved
core/arch/arm/proc.c Outdated Show resolved Hide resolved
core/arch/emit_utils_shared.c Show resolved Hide resolved
core/arch/emit_utils_shared.c Outdated Show resolved Hide resolved
core/arch/interp.c Outdated Show resolved Hide resolved
suite/tests/client-interface/avx512ctx.c Outdated Show resolved Hide resolved
Hendrik Greving added 2 commits July 19, 2019 06:40
@hgreving2304
Copy link
Author

PTAL.

core/arch/aarch64/proc.c Outdated Show resolved Hide resolved
core/arch/aarch64/proc.c Show resolved Hide resolved
core/arch/arch.c Outdated Show resolved Hide resolved
core/arch/arch.c Outdated Show resolved Hide resolved
core/arch/arm/proc.c Outdated Show resolved Hide resolved
core/arch/emit_utils_shared.c Show resolved Hide resolved
core/arch/x86/proc.c Outdated Show resolved Hide resolved
@hgreving2304 hgreving2304 merged commit 1beb546 into master Jul 20, 2019
@hgreving2304 hgreving2304 deleted the i1312-support-code-cache-context-switching branch July 20, 2019 19:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants