Repository navigation
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/178639
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit 34174f7 with merge base 39565a7 ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
This PR needs a
|
Summary: Implements fast-path for ARM approximate clock. There's a similar PR out for PyTorch, as these files are copy-pasted from there: pytorch/pytorch#178639 Differential Revision: D98514697
Summary: Implements fast-path for ARM approximate clock. There's a similar PR out for PyTorch, as these files are copy-pasted from there: pytorch/pytorch#178639 Reviewed By: jiannanWang Differential Revision: D98514697
Summary: Implements fast-path for ARM approximate clock. There's a similar PR out for PyTorch, as these files are copy-pasted from there: pytorch/pytorch#178639 Reviewed By: jiannanWang Differential Revision: D98514697
Summary: Pull Request resolved: pytorch#1333 Implements fast-path for ARM approximate clock. There's a similar PR out for PyTorch, as these files are copy-pasted from there: pytorch/pytorch#178639 Reviewed By: jiannanWang Differential Revision: D98514697
Summary: Implements fast-path for ARM approximate clock. There's a similar PR out for PyTorch, as these files are copy-pasted from there: pytorch/pytorch#178639 Reviewed By: jiannanWang Differential Revision: D98514697
Summary: Implements fast-path for ARM approximate clock. There's a similar PR out for PyTorch, as these files are copy-pasted from there: pytorch/pytorch#178639 Reviewed By: jiannanWang Differential Revision: D98514697
Summary: Implements fast-path for ARM approximate clock. There's a similar PR out for PyTorch, as these files are copy-pasted from there: pytorch/pytorch#178639 Reviewed By: jiannanWang Differential Revision: D98514697
Summary: Implements fast-path for ARM approximate clock. There's a similar PR out for PyTorch, as these files are copy-pasted from there: pytorch/pytorch#178639 Reviewed By: jiannanWang Differential Revision: D98514697
Summary: Implements fast-path for ARM approximate clock. There's a similar PR out for PyTorch, as these files are copy-pasted from there: pytorch/pytorch#178639 Reviewed By: jiannanWang Differential Revision: D98514697
Summary: Pull Request resolved: pytorch#1333 Implements fast-path for ARM approximate clock. There's a similar PR out for PyTorch, as these files are copy-pasted from there: pytorch/pytorch#178639 Reviewed By: jiannanWang Differential Revision: D98514697
Summary: Pull Request resolved: pytorch#1333 Implements fast-path for ARM approximate clock. There's a similar PR out for PyTorch, as these files are copy-pasted from there: pytorch/pytorch#178639 Reviewed By: jiannanWang Differential Revision: D98514697
Summary: Implements fast-path for ARM approximate clock. There's a similar PR out for PyTorch, as these files are copy-pasted from there: pytorch/pytorch#178639 Reviewed By: jiannanWang Differential Revision: D98514697
Summary: Implements fast-path for ARM approximate clock. There's a similar PR out for PyTorch, as these files are copy-pasted from there: pytorch/pytorch#178639 Reviewed By: jiannanWang Differential Revision: D98514697
Summary: Pull Request resolved: pytorch#1333 Implements fast-path for ARM approximate clock. There's a similar PR out for PyTorch, as these files are copy-pasted from there: pytorch/pytorch#178639 Reviewed By: jiannanWang Differential Revision: D98514697
|
@pytorchbot merge |
Merge startedYour change will be merged once all checks pass (ETA 0-4 Hours). Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
Summary: Pull Request resolved: #1333 Implements fast-path for ARM approximate clock. There's a similar PR out for PyTorch, as these files are copy-pasted from there: pytorch/pytorch#178639 Reviewed By: ryanzhang22, jiannanWang Differential Revision: D98514697 fbshipit-source-id: 7dad173cf1a299ebdf28cfabfb2ff3e69e9c6473
There is a similar PR out for Kineto, as these files are copy-pasted to there: pytorch/kineto#1333 Pull Request resolved: #178639 Approved by: https://github.com/jiannanWang
There is a similar PR out for Kineto, as these files are copy-pasted to there: pytorch/kineto#1333 Pull Request resolved: pytorch#178639 Approved by: https://github.com/jiannanWang
|
Hi! Does this need a kineto bump to include the associated commit as well? I noticed I stopped getting CUDA events with this merged in. |
There is a similar PR out for Kineto, as these files are copy-pasted to there: pytorch/kineto#1333 Pull Request resolved: #178639 Approved by: https://github.com/jiannanWang
## Summary `getApproximateTime()` returns a cheap monotonic counter that the profiler calibrates against wall-clock time, avoiding a `clock_gettime` syscall on every timestamp. It uses `__rdtsc` on x86 and `cntvct_el0` on aarch64, but had **no RISC-V branch** — so on RISC-V every timestamp fell back to the `getTime()` syscall path, the slow path this mechanism exists to avoid. This adds a RISC-V (rv64) fast path that reads the `time` CSR via `rdtime`, mirroring the aarch64 `cntvct_el0` path from #178639. ## Details `rdtime` is a constant-frequency counter and is user-readable on Linux — the same assumption the aarch64 path already makes for `cntvct_el0`. The branch is gated on `__riscv_xlen == 64` because on RV32 `rdtime` returns only the low 32 bits, so RV32 correctly keeps the `getTime()` fallback. **Alternative considered:** `rdcycle`. It counts core cycles, which vary with frequency scaling and are commonly privileged (trap) in user mode, so it is unsuitable for a wall-time approximation; `rdtime` is the right counter. ## Test plan ``` # riscv64 emits the rdtime fast path: clang --target=riscv64-unknown-elf -march=rv64gc -ffreestanding -O2 -c harness.c llvm-objdump -d harness.o # getApproximateTime: c0102573 rdtime a0 # rv32 correctly keeps the syscall fallback (no rdtime, calls getTime): clang --target=riscv32-unknown-elf -march=rv32gc -ffreestanding -O2 -c harness.c llvm-objdump -dr harness.o # no rdtime; R_RISCV_CALL_PLT getTime # existing aarch64 path still compiles and runs (verified natively): clang harness.c -o t && ./t # rc=0 ``` Part of the RISC-V enablement effort #180975 (Phase 1.3). Pull Request resolved: #189000 Approved by: https://github.com/ezyang
There is a similar PR out for Kineto, as these files are copy-pasted to there: pytorch/kineto#1333 Pull Request resolved: pytorch#178639 Approved by: https://github.com/jiannanWang
## Summary `getApproximateTime()` returns a cheap monotonic counter that the profiler calibrates against wall-clock time, avoiding a `clock_gettime` syscall on every timestamp. It uses `__rdtsc` on x86 and `cntvct_el0` on aarch64, but had **no RISC-V branch** — so on RISC-V every timestamp fell back to the `getTime()` syscall path, the slow path this mechanism exists to avoid. This adds a RISC-V (rv64) fast path that reads the `time` CSR via `rdtime`, mirroring the aarch64 `cntvct_el0` path from pytorch#178639. ## Details `rdtime` is a constant-frequency counter and is user-readable on Linux — the same assumption the aarch64 path already makes for `cntvct_el0`. The branch is gated on `__riscv_xlen == 64` because on RV32 `rdtime` returns only the low 32 bits, so RV32 correctly keeps the `getTime()` fallback. **Alternative considered:** `rdcycle`. It counts core cycles, which vary with frequency scaling and are commonly privileged (trap) in user mode, so it is unsuitable for a wall-time approximation; `rdtime` is the right counter. ## Test plan ``` # riscv64 emits the rdtime fast path: clang --target=riscv64-unknown-elf -march=rv64gc -ffreestanding -O2 -c harness.c llvm-objdump -d harness.o # getApproximateTime: c0102573 rdtime a0 # rv32 correctly keeps the syscall fallback (no rdtime, calls getTime): clang --target=riscv32-unknown-elf -march=rv32gc -ffreestanding -O2 -c harness.c llvm-objdump -dr harness.o # no rdtime; R_RISCV_CALL_PLT getTime # existing aarch64 path still compiles and runs (verified natively): clang harness.c -o t && ./t # rc=0 ``` Part of the RISC-V enablement effort pytorch#180975 (Phase 1.3). Pull Request resolved: pytorch#189000 Approved by: https://github.com/ezyang
## Summary `getApproximateTime()` returns a cheap monotonic counter that the profiler calibrates against wall-clock time, avoiding a `clock_gettime` syscall on every timestamp. It uses `__rdtsc` on x86 and `cntvct_el0` on aarch64, but had **no RISC-V branch** — so on RISC-V every timestamp fell back to the `getTime()` syscall path, the slow path this mechanism exists to avoid. This adds a RISC-V (rv64) fast path that reads the `time` CSR via `rdtime`, mirroring the aarch64 `cntvct_el0` path from pytorch#178639. ## Details `rdtime` is a constant-frequency counter and is user-readable on Linux — the same assumption the aarch64 path already makes for `cntvct_el0`. The branch is gated on `__riscv_xlen == 64` because on RV32 `rdtime` returns only the low 32 bits, so RV32 correctly keeps the `getTime()` fallback. **Alternative considered:** `rdcycle`. It counts core cycles, which vary with frequency scaling and are commonly privileged (trap) in user mode, so it is unsuitable for a wall-time approximation; `rdtime` is the right counter. ## Test plan ``` # riscv64 emits the rdtime fast path: clang --target=riscv64-unknown-elf -march=rv64gc -ffreestanding -O2 -c harness.c llvm-objdump -d harness.o # getApproximateTime: c0102573 rdtime a0 # rv32 correctly keeps the syscall fallback (no rdtime, calls getTime): clang --target=riscv32-unknown-elf -march=rv32gc -ffreestanding -O2 -c harness.c llvm-objdump -dr harness.o # no rdtime; R_RISCV_CALL_PLT getTime # existing aarch64 path still compiles and runs (verified natively): clang harness.c -o t && ./t # rc=0 ``` Part of the RISC-V enablement effort pytorch#180975 (Phase 1.3). Pull Request resolved: pytorch#189000 Approved by: https://github.com/ezyang
Summary: Pull Request resolved: pytorch/kineto#1333 Implements fast-path for ARM approximate clock. There's a similar PR out for PyTorch, as these files are copy-pasted from there: pytorch/pytorch#178639 Reviewed By: ryanzhang22, jiannanWang Differential Revision: D98514697 fbshipit-source-id: 7dad173cf1a299ebdf28cfabfb2ff3e69e9c6473 Signed-off-by: Antoni Viros i Martin <[email protected]>
There is a similar PR out for Kineto, as these files are copy-pasted to there: pytorch/kineto#1333 Pull Request resolved: pytorch#178639 Approved by: https://github.com/jiannanWang
## Summary `getApproximateTime()` returns a cheap monotonic counter that the profiler calibrates against wall-clock time, avoiding a `clock_gettime` syscall on every timestamp. It uses `__rdtsc` on x86 and `cntvct_el0` on aarch64, but had **no RISC-V branch** — so on RISC-V every timestamp fell back to the `getTime()` syscall path, the slow path this mechanism exists to avoid. This adds a RISC-V (rv64) fast path that reads the `time` CSR via `rdtime`, mirroring the aarch64 `cntvct_el0` path from pytorch#178639. ## Details `rdtime` is a constant-frequency counter and is user-readable on Linux — the same assumption the aarch64 path already makes for `cntvct_el0`. The branch is gated on `__riscv_xlen == 64` because on RV32 `rdtime` returns only the low 32 bits, so RV32 correctly keeps the `getTime()` fallback. **Alternative considered:** `rdcycle`. It counts core cycles, which vary with frequency scaling and are commonly privileged (trap) in user mode, so it is unsuitable for a wall-time approximation; `rdtime` is the right counter. ## Test plan ``` # riscv64 emits the rdtime fast path: clang --target=riscv64-unknown-elf -march=rv64gc -ffreestanding -O2 -c harness.c llvm-objdump -d harness.o # getApproximateTime: c0102573 rdtime a0 # rv32 correctly keeps the syscall fallback (no rdtime, calls getTime): clang --target=riscv32-unknown-elf -march=rv32gc -ffreestanding -O2 -c harness.c llvm-objdump -dr harness.o # no rdtime; R_RISCV_CALL_PLT getTime # existing aarch64 path still compiles and runs (verified natively): clang harness.c -o t && ./t # rc=0 ``` Part of the RISC-V enablement effort pytorch#180975 (Phase 1.3). Pull Request resolved: pytorch#189000 Approved by: https://github.com/ezyang
There is a similar PR out for Kineto, as these files are copy-pasted to there: pytorch/kineto#1333
cc @snadampal @milpuz01 @aditew01 @nikhil-arm @fadara01 @nWEIdia