Skip to content

Commit 44c99f8

Browse files
committed
[Lang] qd.precise: replace -- with single - in comments
1 parent 48ce67b commit 44c99f8

4 files changed

Lines changed: 9 additions & 9 deletions

File tree

python/quadrants/lang/ops.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,14 +111,14 @@ def precise(obj):
111111
binary ops are reached even when wrapped, e.g.
112112
``qd.precise(qd.bit_cast(a + b, qd.f32))``. It stops at loads,
113113
constants, ``qd.func`` calls, ndarray accesses, etc.; semantics inside
114-
a ``qd.func`` body are governed by that body's own ops -- wrap calls
114+
a ``qd.func`` body are governed by that body's own ops - wrap calls
115115
separately if needed.
116116
117117
Notes:
118118
* Tagging is in-place on the underlying ``Expression`` nodes
119119
(which are shared via ``shared_ptr``). If you alias a
120120
subexpression and then wrap one alias in ``qd.precise``, the
121-
tag travels with the value -- both uses get IEEE semantics.
121+
tag travels with the value - both uses get IEEE semantics.
122122
123123
Args:
124124
obj: A scalar Quadrants expression (typically a chain of FP ops).

quadrants/codegen/spirv/spirv_codegen.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -889,7 +889,7 @@ void TaskCodegen::visit(UnaryOpStmt *stmt) {
889889
// meaningful on actual arithmetic instructions (`OpFNegate` from `neg`, `OpFDiv` synthesized by `inv`)
890890
// where SPIRV-Cross maps it to MSL's `precise` qualifier. For transcendentals emitted via
891891
// `OpExtInst GLSL.std.450 Sin/Cos/Log/Sqrt/...`, the SPIR-V spec scopes `NoContraction` to arithmetic
892-
// instructions so most consumers will ignore it -- there is no standard SPIR-V mechanism to force
892+
// instructions so most consumers will ignore it - there is no standard SPIR-V mechanism to force
893893
// correctly-rounded transcendentals, so on those paths we rely on the driver's default (non-fast-math)
894894
// stdlib being accurate enough. The decoration is kept as best-effort future-proofing.
895895
if (stmt->precise && is_real(stmt->element_type())) {

quadrants/ir/expr.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ Expr precise(const Expr &input) {
5656
// Walk the subtree; tag every BinaryOpExpression we find. We also recurse through UnaryOpExpression and
5757
// TernaryOpExpression so users can write things like `qd.precise(qd.bit_cast(a + b, qd.f32))` or
5858
// `qd.precise(qd.select(c, a + b, x - y))` and still have the inner FP ops tagged. Recursion stops at
59-
// any other Expression kind (loads, constants, qd.func calls, etc.) -- semantics inside e.g. a qd.func
59+
// any other Expression kind (loads, constants, qd.func calls, etc.) - semantics inside e.g. a qd.func
6060
// body are governed by that body's own ops. A worklist keeps stack depth bounded since deep AST chains
6161
// in scientific code aren't rare.
6262
std::vector<Expr> stack{input};

tests/python/test_precise.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
@test_utils.test(default_fp=qd.f32, fast_math=True)
2020
def test_qd_precise_protects_fast_math():
2121
"""Run Dekker 2Sum twice under `fast_math=True`: once unprotected (the
22-
compensation term must be folded to zero -- that is the very bug
22+
compensation term must be folded to zero - that is the very bug
2323
`qd.precise` exists to fix) and once with `qd.precise(...)` wrapping
2424
every FP op (the compensation term must survive).
2525
"""
@@ -91,7 +91,7 @@ def df_accum_precise(in_arr: qd.types.ndarray(qd.f32, ndim=1), out: qd.types.nda
9191
# distinguishes `precise` from non-`precise` BinaryOpExpressions. The two kernels are structurally
9292
# identical apart from `qd.precise(...)` wrappers, so if the cache key did not account for `precise`
9393
# (as was the case before), the second compile would silently reuse the first's artifact and
94-
# `df_accum_precise` would produce naive behavior -- caught by the final assertion below.
94+
# `df_accum_precise` would produce naive behavior - caught by the final assertion below.
9595
df_accum_naive(in_arr, out_naive)
9696
df_accum_precise(in_arr, out_precise)
9797

@@ -106,12 +106,12 @@ def df_accum_precise(in_arr: qd.types.ndarray(qd.f32, ndim=1), out: qd.types.nda
106106
# `qd.precise` must restore IEEE semantics locally: the compensation term must be non-trivially non-zero.
107107
assert abs(float(lo_precise)) > 1e-10, (
108108
f"qd.precise failed to protect 2Sum: lo={lo_precise!r} (expected |lo| > 1e-10). "
109-
f"The backend folded `(a - aa) + (b - bb)` to zero -- IEEE-strict ordering was not honored."
109+
f"The backend folded `(a - aa) + (b - bb)` to zero - IEEE-strict ordering was not honored."
110110
)
111111

112112
# And the compensated sum must beat the naive f32 sum by orders of magnitude. This is the end-to-end
113113
# guarantee `qd.precise` exists to provide; it also indirectly validates that the offline-cache key
114-
# generator distinguishes `precise` from non-`precise` BinaryOpExpressions -- if it did not, the two
114+
# generator distinguishes `precise` from non-`precise` BinaryOpExpressions - if it did not, the two
115115
# kernels (structurally identical apart from `qd.precise(...)` wrappers) would share a compiled artifact
116116
# and `out_precise` would match `out_naive`.
117117
ds_err = abs(float(hi_precise) + float(lo_precise) - expected_f64)
@@ -135,7 +135,7 @@ def test_qd_precise_unary_rounding():
135135
`fast_math=True` happens to give correctly-rounded transcendentals
136136
anyway and a comparison against it would be uninformative. `sqrt`
137137
is included because LLVM FMF's `afn` can substitute `rsqrt+refine`
138-
which is ~2-3 ULP -- the precise tag must defeat that substitution.
138+
which is ~2-3 ULP - the precise tag must defeat that substitution.
139139
"""
140140

141141
@qd.kernel

0 commit comments

Comments
 (0)