Files
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

47 lines
1.4 KiB
C

#include <asm/hwcap.h>
#include <stdint.h>
#include <sys/auxv.h>
#ifndef HWCAP2_FPMR
#define HWCAP2_FPMR (1UL << 48)
#endif
uint64_t get_fpmr(void) {
uint64_t fpmr = 0;
__asm__ volatile("mrs %0, s3_3_c4_c4_2" : "=r"(fpmr));
return fpmr;
}
void set_fpmr(uint64_t value) {
__asm__ volatile("msr s3_3_c4_c4_2, %0" ::"r"(value));
}
// Set F8S1 (bits 0-2) and LSCALE2 (bits 37-32) (to prove we treat fpmr as 64
// bit).
const uint64_t original_fpmr = (uint64_t)0b101010 << 32 | (uint64_t)0b101;
void expr_func() { set_fpmr(original_fpmr); }
int main(int argc, char *argv[]) {
if (!(getauxval(AT_HWCAP2) & HWCAP2_FPMR))
return 1;
// As FPMR controls a bunch of floating point options that are quite
// extensive, we're not going to run any floating point ops here. Instead just
// update the value from the debugger and check it from this program, and vice
// versa.
set_fpmr(original_fpmr);
// Here the debugger checks it read back the value above, then writes in a new
// value. Note that the bits are flipped in the new value.
uint64_t new_fpmr = get_fpmr(); // Set break point at this line.
uint64_t expected_fpmr = ((uint64_t)0b010101 << 32) | (uint64_t)0b010;
// If the debugger failed to update the value, exit uncleanly.
// This also allows you to run this program standalone to create a core file.
if (new_fpmr != expected_fpmr)
__builtin_trap();
return 0;
}