Skip to content

Compile error in fftbase.cl: U2() returns ulong2 assigned to F2, when TAIL_TRIGS31=1 with FFT_FP32=1 + NTT_GF61=1 (variant 202) #349

Description

@y888

Summary

During -tune on FFT spec 1:512:8:512:202 (FFT_FP32=1, NTT_GF61=1, NTT_GF31=0), the tuner tests TAIL_TRIGS31=1 successfully on the tail kernel, selects it as best, and then fails to compile fftp.cl with a type mismatch in fftbase.cl. The tuner exits and the tuning run is aborted.

Environment

  • OS: Windows (AMD GPU, compiled via comgr / ROCm OpenCL)
  • FFT spec: 1:512:8:512:202 (FP32 + GF61 NTT)

Error

In file included from ...\input\CompileSource:1:
In file included from ...\include\fftp.cl:5:
In file included from ...\include\fftwidth.cl:18:
...\include\fftbase.cl:1136:8: error: assigning to '__private F2' (aka '__private float2') from incompatible type 'ulong2' (vector of 2 'ulong' values)
 1136 |   base = U2(fma(a, -w.y, w.x), fma(a, w.x, -w.y));
      |        ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
Error: Failed to compile source (from CL or HIP source to LLVM IR).

Full compile args of the failing kernel:

-cl-finite-math-only -cl-std=CL2.0 -DFAST_BARRIER=0 -DINPLACE=0 -DIN_SIZEX=8 -DIN_WG=256
-DLOADS=11010 -DMIDDLE_IN_LDS_TRANSPOSE=1 -DMIDDLE_OUT_LDS_TRANSPOSE=1 -DOUT_SIZEX=32
-DOUT_WG=256 -DPAD=0 -DSTORES=10 -DTAIL_KERNELS=2 -DTAIL_TRIGS31=1 -DTAIL_TRIGS32=0
-DEXP=126152063u -DWIDTH=512u -DSMALL_HEIGHT=512u -DMIDDLE=8u -DCARRY_LEN=8u -DNW=8u -DNH=8u
-DAMDGPU=1 -DCARRY64=1 -DFFT_VARIANT=202u -DMAXBPW=3166u
-DWEIGHT_STEP=0.896059698234141 -DIWEIGHT_STEP=-0.47259044589612292
-DTAILT=U2(-1.88247177e-05f,0.00613588467f) -DTRIG_SCALE=9
-DTRIG_SIN={...} -DTRIG_COS={...}
-DTAILTGF61=U2(807738046998073027ull,30095103403839256ull) -DFFT_TYPE=2 -DWordSize=8u
-DDISTGF61=1048576ull -DDISTWTRIGGF61=132416ull -DDISTMTRIGGF61=768ull -DDISTHTRIGGF61=132416ull
-DFRAC_BPW_HI=330693631u -DFRAC_BPW_LO=4294967295u -DFFT_FP32=0? (actual: -DFFT_FP32=1) -DNTT_GF31=0 -DNTT_GF61=1

Analysis

The failing line is in the FP32 (F2) version of chainMul4 in fftbase.cl:

F2 base = csqTrig(w);
...
F a = mul2(base.y);
base = U2(fma(a, -w.y, w.x), fma(a, w.x, -w.y));   // <-- error here

U2() is overload-resolved by argument type (base.cl: float -> float2, ulong -> ulong2). With TAIL_TRIGS31=1 in this FP32+GF61 configuration, w/the fma operands on this code path resolve to the GF61 ulong types, so U2() returns ulong2, which cannot be assigned to the F2 base — compile fails.

It looks like TAIL_TRIGS31=1 combined with FFT_FP32=1 + NTT_GF61=1 (and NTT_GF31=0) is an untested code-path combination — TAIL_TRIGS31 presumably targets the GF31 NTT, which is disabled in this variant.

Steps to reproduce

  1. Run -tune on an AMD GPU with FFT 1:512:8:512:202.
  2. The tuner's isolated TAIL_TRIGS31=1 test compiles and times fine (only the tail kernel is rebuilt), and gets selected as best (1722.4 vs 1753.7 in my run).
  3. The next compile of fftp.cl (which includes fftbase.cl with TAIL_TRIGS31=1 now globally set) fails as above, and the program exits: Exiting because "Can't compile fftp.cl".

Impact / workaround

  • The whole tuning run aborts partway through.
  • Workaround: pin -use TAIL_TRIGS31=0 and re-run tune (giving up the ~1.8% improvement measured for TAIL_TRIGS31=1).

Perhaps the tuner should also skip TAIL_TRIGS31 when NTT_GF31=0, or validate the flag combination before selecting it.-

(我运行 prpll-ntt_win64-opencl_20260525 但是失败了。用的是AMD RX 9060 XT)

(我不知道是什么错误🥲使用qwenLLM后-让我提交的)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions