add arm64 support for clock frequency helpers#79
Open
sdimitro wants to merge 1 commit intoPlatformLab:mainfrom
Open
add arm64 support for clock frequency helpers#79sdimitro wants to merge 1 commit intoPlatformLab:mainfrom
sdimitro wants to merge 1 commit intoPlatformLab:mainfrom
Conversation
homa_clock() calls get_cycles(), whose backing source is
arch-specific: RDTSC on x86 (frequency tsc_khz) and the
generic timer on arm64 (frequency arch_timer_get_cntfrq()).
Make homa_clock_khz() return the correct value per arch:
- x86: tsc_khz (not cpu_khz -- the kernel tracks them
separately and they can diverge)
- arm64: arch_timer_get_cntfrq() / 1000
- other: 1000000 (fallback)
Guard the tsc_khz-dependent scaling in homa_metrics_print()
behind CONFIG_X86 and emit raw cycle counts on other arches
where Linux and homa_clock() share the same counter.
Replace bare tsc_khz references in timetrace.c with
homa_clock_khz() so the emitted cpu_khz header is correct
on all architectures.
Signed-off-by: Serapheim Dimitropoulos <sdimitropoulos@coreweave.com>
d7afcd1 to
2bae9a4
Compare
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Without this patch, building HomaModule on arm64 fails with the following message:
homa_clock()callsget_cycles(), whose backing source is arch-specific: RDTSC on x86 (frequency tsc_khz) and the generic timer on arm64 (frequencyarch_timer_get_cntfrq()).Make homa_clock_khz() return the correct value per arch:
tsc_khzarch_timer_get_cntfrq() / 10001000000(fallback)Guard the
tsc_khz-dependent scaling inhoma_metrics_print()behindCONFIG_X86and emit raw cycle counts on other arches where Linux andhoma_clock()share the same counter.Replace bare
tsc_khzreferences intimetrace.cwithhoma_clock_khz()so the emittedcpu_khzheader is correct on all architectures.