Skip to content

Add validated native Goldilocks/G64 4-step NTT benchmark#6

Open
uulong950 wants to merge 1 commit into
Alisah-Ozcan:paper_versionfrom
uulong950:bench/validated-goldilocks-g64
Open

Add validated native Goldilocks/G64 4-step NTT benchmark#6
uulong950 wants to merge 1 commit into
Alisah-Ozcan:paper_versionfrom
uulong950:bench/validated-goldilocks-g64

Conversation

@uulong950

Copy link
Copy Markdown

This PR adds a standalone validated native Goldilocks/G64 benchmark for the paper_version 4-step NTT path.

The existing generic benchmark is useful as a timing microbenchmark, but it does not attempt to validate native Goldilocks semantics. In particular, it uses randomly generated modulus/root/W tables and does not copy GPU output back for comparison against a CPU reference.

This benchmark uses a stricter native Goldilocks contract:

  • Goldilocks modulus p = 2^64 - 2^32 + 1
  • modulus hex 0xffffffff00000001
  • generator 7
  • primitive N-th roots and twiddles
  • NTTParameters4Step-compatible GPU root-table bit-reversal order
  • W-table layout matching the 4-step implementation
  • official transpose -> GPU_4STEP_NTT -> transpose wrapper
  • independent natural-order CPU reference
  • full random-input validation
  • median / p95 timing output

One important detail is that direct calls to GPU_4STEP_NTT operate on the internal 4-step layout. The validated benchmark therefore uses the same transpose wrapper as the example code and reconstructs natural-order output for CPU-reference validation.

Local validation on RTX 4090:

field = Goldilocks
modulus_hex = 0xffffffff00000001
generator = 7
logn = 24
n = 16777216
logical_size = 2097152
lde = 8
batch = 1
input = random
validation = full independent CPU reference
mismatch_count = 0
validation_status = pass

Timing on RTX 4090:

device wrapper, transpose + GPU_4STEP_NTT + transpose:
runs = 50
warmup = 1
median_ms = 1.66400
p95_ms = 1.66905
validation_status = pass

Core-only timing mode is also included for separating the inner 4-step kernel cost from the wrapper cost:

core-only GPU_4STEP_NTT:
runs = 50
warmup = 1
median_ms = 1.00762
p95_ms = 1.01301
validation_status = pass

The CPU reference is a simple independent natural-order Goldilocks NTT implementation used only for correctness validation. It is not a performance benchmark and is not included in the CUDA event timing region.

The goal of this PR is not to change the existing generic benchmark semantics, but to add a separate reproducible benchmark for native Goldilocks/G64 comparisons.

@uulong950

Copy link
Copy Markdown
Author

I also verified the pushed PR branch from a fresh clone of my fork.

Environment:

CUDA = 12.8
GPU = RTX 4090
CMAKE_CUDA_ARCHITECTURES = 89
MODULAR_REDUCTION_TYPE = 1
branch = bench/validated-goldilocks-g64
commit = cc16571

Fresh-clone validation:

logn = 12
timed_region = device_wrapper_transpose_core_transpose
input = random
mismatch_count = 0
validation_status = pass
logn = 12
timed_region = core_only_gpu_4step_ntt
input = random
mismatch_count = 0
validation_status = pass

I also ran a short large-size smoke test from the fresh clone:

logn = 24
n = 16777216
logical_size = 2097152
timed_region = device_wrapper_transpose_core_transpose
runs = 3
warmup = 1
median_ms = 1.66502
cpu_reference_seconds = 5.94964
mismatch_count = 0
validation_status = pass

This confirms that the pushed PR branch does not depend on local untracked files or build artifacts.

@uulong950

Copy link
Copy Markdown
Author

I also tried extending this validated G64 benchmark to logn = 25..27.

Current observation:

logn = 24 works and validates correctly.

logn >= 25 currently prints This ring size is not supported!, so the current paper_version 4-step path does not seem to produce valid G64 benchmark data for 2^25..2^27 yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant