Softsign on LLVM NVPTX

Softsign Activation

— unknown status

Operation

OperationSoftsign (bpd_softsign)
Formulaf(x) = x / (1 + |x|)
CategoryRational

Kernel Specification (Prolog/Logtalk)

This is the backend-neutral op_expr fact that specifies the operation. The same term is lowered to LLVM IR, CUDA C, MLIR, and every other backend — one specification, many targets.

op_expr(bpd_softsign,
    div(var, add(const(1.0), call(abs, var)))).

Backend

BackendLLVM NVPTX (llvm_nvptx)
Targetnvptx
DescriptionLLVM IR targeting NVIDIA PTX (GPU). Compiled with llc for nvptx64, loaded via CUDA driver API.

Generated Code

This is the actual LLVM IR (NVPTX) emitted by our Prolog/Logtalk toolchain for this operation. Every instruction was generated from a declarative op_expr specification — no hand-written assembly.

; GENERATED from op_expr(bpd_softsign) via lower_llvm — backend 4 (shared AST).
declare float @llvm.fabs.f32(float)
define void @softsign(float* noalias %src, float* noalias %dst, i64 %n) {
entry:
  br label %loop
loop:
  %i = phi i64 [0, %entry], [%inext, %body]
  %cond = icmp slt i64 %i, %n
  br i1 %cond, label %body, label %done
body:
  %sp = getelementptr float, float* %src, i64 %i
  %v = load float, float* %sp, align 4
  %l0 = fadd float 0.0, 1.0
  %l1 = call float @llvm.fabs.f32(float %v)
  %l2 = fadd float %l0, %l1
  %l3 = fdiv float %v, %l2
  %dp = getelementptr float, float* %dst, i64 %i
  store float %l3, float* %dp, align 4
  %inext = add i64 %i, 1
  br label %loop
done:
  ret void
}

Verification

TierSILVER — 0 ULP, robustness testing pending
ULP Divergence0
Source Commitb03bc23f7
Deploymentdeployed
Measured2026-09-25
HardwareNVIDIA Tesla P4 (enclave GPU)
GateOutput compared to PyTorch reference on identical input tensor. 0 ULP = every floating-point bit matches.