-
Notifications
You must be signed in to change notification settings - Fork 31
BlackScholesFloat4
Portalez Régis edited this page May 11, 2026
·
14 revisions
Same numerics as BlackScholes but each thread processes 4 options at a time using float4. Two effects:
-
128-bit wide loads/stores (
ld.global.v4.f32) — much higher effective bandwidth than four 32-bit transactions. - ILP — the four lanes give the scheduler more independent work to overlap with memory latency.
Source: src/4.Finance/BlackScholesFloat4/Program.cs
Same kernel structure, with arithmetic replicated across .x / .y / .z / .w. For example, the cumulative-normal-distribution helper:
Scalar version:
float K = 1.0f / (1.0f + 0.2316419f * fabsf(f));float4 version:
float4 K;
K.x = __fdividef(1.0F, 1.0f + 0.2316419f * fabsf(f.x));
K.y = __fdividef(1.0F, 1.0f + 0.2316419f * fabsf(f.y));
K.z = __fdividef(1.0F, 1.0f + 0.2316419f * fabsf(f.z));
K.w = __fdividef(1.0F, 1.0f + 0.2316419f * fabsf(f.w));__fdividef is mapped via [IntrinsicFunction] and skips IEEE-754 division denormal handling — significantly faster, slight precision loss acceptable here.
1. Simple
2. Imaging
3. Maths
- Naive Matrix
- Shared Matrix
- Sparse Matrix
- Conjugate Gradient
- Newton Fractal
- Mandelbulb
- NBody
- Monte Carlo Heat Equation
4. Finance
5. CUDA Runtime
6. Advanced
- GenericFunctions
- GenericMemoryAccess
- GenericReduction
- InterfacesReduction
- LambdaReduction
- SimpleMetadataDecorator
7. AI