codeplaysoftware / oneapi-construction-kit

Other
55 stars 21 forks source link

[RISC-V][host] Change memcpy/move/set to builtins. #440

Closed hvdijk closed 2 months ago

hvdijk commented 2 months ago

Overview

[RISC-V][host] Change memcpy/move/set to builtins.

Reason for change

Generally, when running on host, we import the host versions of various functions including memcpy and memset. For 64-bit RISC-V, we cannot do this because the code model requires offsets for call instructions to be no more than about 2GiB, which our allocations cannot ensure, resulting in failures when the allocation happens to end up in the wrong memory location.

Description of change

This commit changes RISC-V host to instead pick up memcpy/memset from the builtins, effectively meaning their definition becomes part of the kernel, avoiding the problem because the kernel code is allocated contiguously.

Anything else we should know?

This change is done both for 32-bit and for 64-bit RISC-V for simplicity. 32-bit RISC-V should not need this, but it does no harm.

Checklist