Repository navigation
UCS/ARCH/LOONGARCH64: Add loongarch64 support - #12187
loongson-zn wants to merge 1 commit into
Conversation
|
🤖 Starting review — findings will be posted here when done. |
|
🤖 CI Triage Agent — TL;DR: The "AUTHORS file update check" failed because PR #12187 introduces a commit from a new contributor (Na Zhang zhangna@loongson.cn) who is not listed in the Full analysisSummary: Azure Pipelines stage "AUTHORS file check" exited with code 1 because Root cause: Not a code or infrastructure defect — this is the codestyle policy gate working as designed. The step computes the PR commit range ( Implicated commit: [REDACTED:Hex High Entropy String] (PR head, author Na Zhang zhangna@loongson.cn) — merged as [REDACTED:Hex High Entropy String] onto base [REDACTED:Hex High Entropy String]. The check script itself is unchanged and not at fault. File: AUTHORS:89 (insertion point; diff hunk header Suggested fix: In the PR branch git fetch origin
./contrib/authors_update.sh origin/master..HEAD
git diff # should show only the one AUTHORS line
git add AUTHORS && git commit -m "AUTHORS: add Na Zhang"
git pushOr add the line manually, preserving Make sure the email used in the Related: PR #12187 (the failing PR). No existing issue found for this check; it is the standard new-contributor AUTHORS gate, consistent with prior commits such as 42c438a and 90c8961 which each updated
|
| return UCS_ERR_UNSUPPORTED; | ||
| } | ||
|
|
||
| static inline uint64_t ucs_arch_read_hres_clock() |
There was a problem hiding this comment.
LoongArch has a constant-rate counter (rdtime.d, with frequency derivable from cpucfg 0x4/0x5). why not use it instead of falling back to gettimeofday()? ucs_get_time() is on the progress/timer hot path, and configure.m4 already defines HAVE_HW_TIMER=1 for non-aarch64 hosts, so test_time.get_time will run and assert ucs_get_time() under 40ns.
|
adding a new architecture with no CI job means nothing here is build- or run-tested upstream. can you share which tests were run on LoongArch hardware (at least Residual coverage gaps: No build or runtime CI for Residual coverage gap: |
|
🤖 Starting review — findings will be posted here when done. |
| * @param[in] _imm 16-bit immediate value | ||
| */ | ||
| #define UCM_BISTRO_LA_JIRL(_regd, _regj, _imm) \ | ||
| (0x4c000000 | ((_imm) << 10) | ((_regj) << 5) | (_regd)) |
There was a problem hiding this comment.
minor: offs16/offs26 are word-scaled (offs = imm << 2), but the doc comments describe them as plain immediates and the macros neither shift nor mask _imm. Harmless today (only 0 is passed) but a trap for the next user — please document it, otherwise a future non-zero value will silently corrupt the opcode.
|
blocker: Suggested fix:
comment: Residual coverage gaps: there is still no |
|
🤖 Starting review — findings will be posted here when done. |
|
🤖 Review complete — no issues found. |
LoongArch64 port — test resultsTested on real LoongArch64 hardware. Environment
BuildConfigured with
|
|
🤖 CI Triage Agent — TL;DR: The Full analysisSummary: Root cause: Evidence it is not caused by the PR commit: [REDACTED:Hex High Entropy String] touches Secondary anomaly worth noting (not the failure): earlier in the same log, Implicated commit: none for the crash — pre-existing race; the mechanism dates to 676b579 (Thomas Vegas) and was last tuned in c77bb48 (shasson5). The PR head [REDACTED:Hex High Entropy String] (Na Zhang, LoongArch64) is not implicated. File: Suggested fix:
Related: PR #12187 (this PR, LoongArch64); #11112 "UCM/BISTRO: Increase grace time to reduce patch race"; #11896 / 390a30e "AZP/TESTS: Build once per GPU test row and share the tree with the workers" (for the missing
|
|
This is a continuation of #9899. |
tvegas1
left a comment
There was a problem hiding this comment.
ucm_reloc_get_pointer() in src/ucm/util/reloc.c treats .dynamic entries as base offsets on RISC-V (glibc does not relocate them when .dynamic is read-only) — is LoongArch64 also in that case? The tests above only cover bistro mode; could you run reloc mode too:
UCX_MEM_MMAP_HOOK_MODE=reloc ./test/gtest/gtest --gtest_filter='malloc_hook*'|
no packaging included |
|
@loongson-zn, did you or your organisation approve the CLA? |
|
@Alexey-Rivkin, how would suggest to add building loongarch64 in CI? Maybe we could use cross-compile packages like below: apt-get install -y --no-install-recommends \
gcc-loongarch64-linux-gnu g++-loongarch64-linux-gnu libc6-dev-loong64-cross \
autoconf automake libtool make pkg-config |
Seems feasible. It needs testing, but first we need mgmt approval. |
|
🤖 Starting review — findings will be posted here when done. |
|
Residual coverage gaps (already raised in earlier rounds, not re-posted): no |
|
🤖 Starting review — findings will be posted here when done. |
|
Residual coverage gap: |
tvegas1
left a comment
There was a problem hiding this comment.
Could you please confirm if you signed CLA?
|
🤖 Starting review — findings will be posted here when done. |
|
Residual coverage gap: there is no Residual coverage gap: the Residual coverage gap: Residual coverage gap: |
|
🤖 Starting review — findings will be posted here when done. |
|
🤖 Review complete — no issues found. |
|
🤖 Starting review — findings will be posted here when done. |
|
|
||
| /* | ||
| * LoongArch `dbar` (data barrier) hint encoding, as defined by the LoongArch | ||
| * architecture manual and the Linux kernel (arch/loongarch/include/asm/barrier.h): |
There was a problem hiding this comment.
minor: this line is 83 columns; docs/CodeStyle.md caps at 80.
| * architecture manual and the Linux kernel (arch/loongarch/include/asm/barrier.h): | |
| * LoongArch `dbar` (data barrier) hint encoding, as defined by the LoongArch | |
| * architecture manual and the Linux kernel | |
| * (arch/loongarch/include/asm/barrier.h): |
|
Not re-raised (already covered in earlier rounds): there is no Not re-raised (already covered in earlier rounds): Not re-raised (already covered in earlier rounds): Not re-raised (already covered in earlier rounds): |
@tvegas1 The link |
tvegas1
left a comment
There was a problem hiding this comment.
@loongson-zn the CLA forms should be available from openucx.org, which seems currently down.
note the latest push changed the copyright from Loongson to Na Zhang — is this contributed as an individual or on behalf of Loongson? that determines which CLA applies.
|
could you pls share reloc mode test results — UCX_MEM_MMAP_HOOK_MODE=reloc ./test/gtest/gtest --gtest_filter='malloc_hook*' |
zn@zn-pc:~/codex-zn/ucx-zn/ucx1104/ucx$ UCX_MEM_MMAP_HOOK_MODE=reloc ./test/gtest/gtest --gtest_filter='malloc_hook_cplusplus.mmap_ptrs'
[ INFO ] dc_x is not available
[ INFO ] ud_v is not available
[ INFO ] ud_x is not available
[ INFO ] rc_v is not available
[ INFO ] rc_x is not available
[ INFO ] srd is not available
[ INFO ] ugni is not available
[ INFO ] dc_x,cuda_copy,rocm_copy is not available
[ INFO ] ud_v,cuda_copy,rocm_copy is not available
[ INFO ] ud_x,cuda_copy,rocm_copy is not available
[ INFO ] rc_v,cuda_copy,rocm_copy is not available
[ INFO ] rc_x,cuda_copy,rocm_copy is not available
[ INFO ] srd,cuda_copy,rocm_copy is not available
[ INFO ] ugni,cuda_copy,rocm_copy is not available
[ INFO ] dc_mlx5 is not available
[ INFO ] ib,cuda_copy,rocm_copy is not available
[ INFO ] rc_x,cuda_copy is not available
[ INFO ] rc_v,cuda_copy is not available
[ INFO ] rc_x,cuda,rocm is not available
[ INFO ] rc_x,cuda_ipc,rocm_ipc,cuda_copy,rocm_copy is not available
[ INFO ] ib,cuda_copy is not available
[ INFO ] rc,dc is not available
[ INFO ] dc_x,rc_x,cuda_copy,rocm_copy is not available
[ INFO ] rc is not available
[ INFO ] ud is not available
[ INFO ] ud_mlx5 is not available
[ INFO ] ib is not available
[ INFO ] rc_x,rc_v,ud_x,ud_v is not available
[ INFO ] dc_x,ud_x,ud_v is not available
[ INFO ] rc_x,rc_v is not available
[ INFO ] dc is not available
[ INFO ] dc_x,ud,cuda_copy,rocm_copy is not available
[ INFO ] rc_mlx5,rc_verbs,cuda_copy,rocm_copy is not available
[ INFO ] Using random seed of 27257
Note: Google Test filter = malloc_hook_cplusplus.mmap_ptrs
[==========] Running 1 test from 1 test suite.
[----------] Global test environment set-up.
[----------] 1 test from malloc_hook_cplusplus, where TypeParam =
[ RUN ] malloc_hook_cplusplus.mmap_ptrs <> <>
[ INFO ] With 1 large blocks: allocated 100000 buffers of 262144 bytes in 1.47776 sec
^C
zn@zn-pc:~/codex-zn/ucx-zn/ucx1104/ucx$ UCX_MEM_MMAP_HOOK_MODE=reloc ./test/gtest/gtest --gtest_filter='malloc_hook*'
[ INFO ] dc_x is not available
[ INFO ] ud_v is not available
[ INFO ] ud_x is not available
[ INFO ] rc_v is not available
[ INFO ] rc_x is not available
[ INFO ] srd is not available
[ INFO ] ugni is not available
[ INFO ] dc_x,cuda_copy,rocm_copy is not available
[ INFO ] ud_v,cuda_copy,rocm_copy is not available
[ INFO ] ud_x,cuda_copy,rocm_copy is not available
[ INFO ] rc_v,cuda_copy,rocm_copy is not available
[ INFO ] rc_x,cuda_copy,rocm_copy is not available
[ INFO ] srd,cuda_copy,rocm_copy is not available
[ INFO ] ugni,cuda_copy,rocm_copy is not available
[ INFO ] dc_mlx5 is not available
[ INFO ] ib,cuda_copy,rocm_copy is not available
[ INFO ] rc_x,cuda_copy is not available
[ INFO ] rc_v,cuda_copy is not available
[ INFO ] rc_x,cuda,rocm is not available
[ INFO ] rc_x,cuda_ipc,rocm_ipc,cuda_copy,rocm_copy is not available
[ INFO ] ib,cuda_copy is not available
[ INFO ] rc,dc is not available
[ INFO ] dc_x,rc_x,cuda_copy,rocm_copy is not available
[ INFO ] rc is not available
[ INFO ] ud is not available
[ INFO ] ud_mlx5 is not available
[ INFO ] ib is not available
[ INFO ] rc_x,rc_v,ud_x,ud_v is not available
[ INFO ] dc_x,ud_x,ud_v is not available
[ INFO ] rc_x,rc_v is not available
[ INFO ] dc is not available
[ INFO ] dc_x,ud,cuda_copy,rocm_copy is not available
[ INFO ] rc_mlx5,rc_verbs,cuda_copy,rocm_copy is not available
[ INFO ] Using random seed of 27272
Note: Google Test filter = malloc_hook*
[==========] Running 24 tests from 4 test suites.
[----------] Global test environment set-up.
[----------] 1 test from malloc_hook_test_no_events, where TypeParam =
[ RUN ] malloc_hook_test_no_events.empty_event <> <>
[ OK ] malloc_hook_test_no_events.empty_event (0 ms)
[----------] 1 test from malloc_hook_test_no_events (0 ms total)
[----------] 9 tests from malloc_hook, where TypeParam =
[ RUN ] malloc_hook.single_thread <> <>
[ INFO ] single-thread: small mapped: 10027008, total mapped: 136069120, total unmapped: 130924544
[ OK ] malloc_hook.single_thread (21 ms)
[ RUN ] malloc_hook.multi_threads <> <>
[ INFO ] thread 7/8: small mapped: 72843264, total mapped: 792494080, total unmapped: 718356480
[ INFO ] thread 5/8: small mapped: 67715072, total mapped: 835321856, total unmapped: 762904576
[ INFO ] thread 6/8: small mapped: 59539456, total mapped: 919388160, total unmapped: 847052800
[ INFO ] thread 1/8: small mapped: 59834368, total mapped: 920993792, total unmapped: 847822848
[ INFO ] thread 0/8: small mapped: 59424768, total mapped: 1004716032, total unmapped: 935903232
[ INFO ] thread 4/8: small mapped: 78856192, total mapped: 1044905984, total unmapped: 977125376
[ INFO ] thread 2/8: small mapped: 67584000, total mapped: 1088471040, total unmapped: 1022001152
[ INFO ] thread 3/8: small mapped: 68141056, total mapped: 1088749568, total unmapped: 1022132224
[ OK ] malloc_hook.multi_threads (233 ms)
[ RUN ] malloc_hook.asprintf <> <>
[ OK ] malloc_hook.asprintf (1 ms)
[ RUN ] malloc_hook.fork <> <>
[ SKIP ] ("broken")
[ OK ] malloc_hook.fork (4 ms)
[ RUN ] malloc_hook.bistro_patch <> <>
[ OK ] malloc_hook.bistro_patch (50 ms)
[ RUN ] malloc_hook.test_event <> <>
[ OK ] malloc_hook.test_event (1 ms)
[ RUN ] malloc_hook.test_event_failed <> <>
[ SKIP ] (RUNNING_ON_VALGRIND || !skip_on_bistro())
[ OK ] malloc_hook.test_event_failed (0 ms)
[ RUN ] malloc_hook.test_external_event <> <>
[ SKIP ] (RUNNING_ON_VALGRIND || !skip_on_bistro())
[ OK ] malloc_hook.test_external_event (0 ms)
[ RUN ] malloc_hook.test_event_unmap <> <>
[ SKIP ] (RUNNING_ON_VALGRIND || !skip_on_bistro())
[ OK ] malloc_hook.test_event_unmap (0 ms)
[----------] 9 tests from malloc_hook (310 ms total)
[----------] 7 tests from malloc_hook_cplusplus, where TypeParam =
[ RUN ] malloc_hook_cplusplus.new_delete <> <>
[ OK ] malloc_hook_cplusplus.new_delete (8 ms)
[ RUN ] malloc_hook_cplusplus.dynamic_mmap_enable <> <>
[ OK ] malloc_hook_cplusplus.dynamic_mmap_enable (3 ms)
[ RUN ] malloc_hook_cplusplus.dynamic_mmap_disable <> <>
[ OK ] malloc_hook_cplusplus.dynamic_mmap_disable (3 ms)
[ RUN ] malloc_hook_cplusplus.mallopt <> <>
[ SKIP ] (MALLOC_TRIM_THRESHOLD_ is not set)
[ OK ] malloc_hook_cplusplus.mallopt (1 ms)
[ RUN ] malloc_hook_cplusplus.mmap_ptrs <> <>
[ INFO ] With 1 large blocks: allocated 100000 buffers of 262144 bytes in 1.45008 sec
[ INFO ] With 16109 large blocks: allocated 100000 buffers of 262144 bytes in 21.0214 sec
[ INFO ] With 16109 large blocks: allocated 100000 buffers of 262144 bytes in 21.0228 sec
[ INFO ] With 16109 large blocks: allocated 100000 buffers of 262144 bytes in 21.0549 sec
^[[B[ INFO ] With 16109 large blocks: allocated 100000 buffers of 262144 bytes in 21.0278 sec
[ INFO ] With 16109 large blocks: allocated 100000 buffers of 262144 bytes in 21.0496 sec
ucm/malloc_hook.cc:1040: Failure
Failed
Failed after 5 attempts
[ FAILED ] malloc_hook_cplusplus.mmap_ptrs, where TypeParam = and GetParam() = (109908 ms)
[ RUN ] malloc_hook_cplusplus.remap_override_single_thread <> <>
[ OK ] malloc_hook_cplusplus.remap_override_single_thread (0 ms)
[ RUN ] malloc_hook_cplusplus.remap_override_multi_threads <> <>
[ OK ] malloc_hook_cplusplus.remap_override_multi_threads (1 ms)
[----------] 7 tests from malloc_hook_cplusplus (109924 ms total)
[----------] 7 tests from malloc_hook_dlopen, where TypeParam =
[ RUN ] malloc_hook_dlopen.indirect_dlopen <> <>
[ OK ] malloc_hook_dlopen.indirect_dlopen (5 ms)
[ RUN ] malloc_hook_dlopen.indirect_ucm_dlopen <> <>
[ OK ] malloc_hook_dlopen.indirect_ucm_dlopen (1 ms)
[ RUN ] malloc_hook_dlopen.rpath_dlopen <> <>
[ OK ] malloc_hook_dlopen.rpath_dlopen (3 ms)
[ RUN ] malloc_hook_dlopen.rpath_ucm_dlopen <> <>
[ OK ] malloc_hook_dlopen.rpath_ucm_dlopen (2 ms)
[ RUN ] malloc_hook_dlopen.ucm_dlopen_null_dlopen <> <>
[ OK ] malloc_hook_dlopen.ucm_dlopen_null_dlopen (0 ms)
[ RUN ] malloc_hook_dlopen.ucm_dlopen_null_ucm_dlopen <> <>
[ OK ] malloc_hook_dlopen.ucm_dlopen_null_ucm_dlopen (5 ms)
[ RUN ] malloc_hook_dlopen.dlopen_mt_with_memtype/mt_2 <> <>
[ OK ] malloc_hook_dlopen.dlopen_mt_with_memtype/mt_2 (186 ms)
[----------] 7 tests from malloc_hook_dlopen (202 ms total)
[----------] Global test environment tear-down
[==========] 24 tests from 4 test suites ran. (110437 ms total)
[ PASSED ] 23 tests.
[ FAILED ] 1 test, listed below:
[ FAILED ] malloc_hook_cplusplus.mmap_ptrs, where TypeParam = and GetParam() =
1 FAILED TEST
I also reproduced the same failure on x86, so this is not LoongArch-specific. |
I’m contributing in my individual capacity, not on behalf of my employer. I haven’t signed the individual CLA yet because the ICLA PDF and the license page linked from the contributor guidelines are currently inaccessible from my side. Could you please let me know whether I should wait for the site to come back online, or if there is an alternative way to sign the individual CLA? For example, is there a direct link to the ICLA PDF, or an email-based submission process? I’m happy to complete it as soon as I have access to the correct form. |
|
Maybe wait for now. |
OK, thanks @tvegas1 |
What?
Add LoongArch64 architecture support to UCS (cpu/bitops/atomic/global_opts,
memory barriers, high-resolution clock) and UCM (BISTRO binary patcher)
Why?
Enables UCX to build and run on LoongArch64 (Loongson) platforms.
How?
Barrier hints match the Linux kernel
arch/loongarch/include/asm/barrier.h;the timer frequency comes from CPUCFG.4/5 as in the kernel's
calc_const_freq().