Skip to content

Commit 1d27016

Browse files
committed
Workaround for Metal logging crashes, with prefer_backend_uniformity to make it compatible for testing
1 parent 35c1a86 commit 1d27016

File tree

8 files changed

+89
-70
lines changed

8 files changed

+89
-70
lines changed

CHANGES.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
- The Metal framework backend (Apple Silicon).
66
- Setting `debug_log_to_stream_files` to neatly keep logs from routine execution in their separate files.
7-
- Setting `clean_up_artifacts_on_startup`.
7+
- Settings `clean_up_artifacts_on_startup`, `prefer_backend_uniformity`.
88
- Tools directory and the `minised` tool: regexp replacement file rewrite.
99

1010
### Changed

arrayjit/lib/c_syntax.ml

Lines changed: 29 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@ module type C_syntax_config = sig
3030
val typ_of_prec : Ops.prec -> string
3131
val ident_blacklist : string list
3232

33+
val float_log_style : string
34+
(** Format specifier for printing floating point numbers in debug logs. *)
35+
36+
val styled_log_arg : PPrint.document -> PPrint.document
37+
(** Function to convert potentially floating-point numeric values for logging. *)
38+
3339
val ternop_syntax :
3440
Ops.prec ->
3541
Ops.ternop ->
@@ -70,6 +76,7 @@ module Pure_C_config (Input : sig
7076

7177
val use_host_memory : (size_in_bytes:int -> unit Ctypes.ptr -> buffer_ptr) option
7278
val procs : Low_level.optimized array
79+
val full_printf_support : bool
7380
end) =
7481
struct
7582
let procs = Input.procs
@@ -86,6 +93,13 @@ struct
8693
let includes = [ "<stdio.h>"; "<stdlib.h>"; "<string.h>"; "<math.h>" ]
8794
let extra_declarations = []
8895
let typ_of_prec = Ops.c_typ_of_prec
96+
let float_log_style = if Input.full_printf_support then "%g" else "%de-3"
97+
98+
let styled_log_arg doc =
99+
if Input.full_printf_support then doc
100+
else
101+
let open PPrint in
102+
string "(int)(" ^^ doc ^^ string " * 1000.0)"
89103

90104
let ident_blacklist =
91105
let remove_paren s = String.substr_replace_all s ~pattern:"(" ~with_:"" in
@@ -303,16 +317,19 @@ module C_syntax (B : C_syntax_config) = struct
303317
let pp_args_docs =
304318
List.map debug_args_docs ~f:(function
305319
| `Accessor idx -> pp_array_offset idx
306-
| `Value v_doc -> v_doc)
320+
| `Value v_doc -> B.styled_log_arg v_doc)
307321
in
308322
let log_args_for_printf =
309-
offset_doc :: (ident_doc ^^ brackets offset_doc) :: new_var :: pp_args_docs
323+
offset_doc
324+
:: B.styled_log_arg (ident_doc ^^ brackets offset_doc)
325+
:: B.styled_log_arg new_var :: pp_args_docs
310326
in
311327
let log_doc =
312328
let log_param_doc = Option.map B.kernel_log_param ~f:(fun (_, name) -> string name) in
313329
let comment_base_msg = Printf.sprintf "# %s\n" debug in
314330
let value_base_msg =
315-
Printf.sprintf "%s[%%u]{=%%g} = %%g = %s\n" (get_ident tn) debug_val_str
331+
Printf.sprintf "%s[%%u]{=%s} = %s = %s\n" (get_ident tn) B.float_log_style
332+
B.float_log_style debug_val_str
316333
in
317334
let comment_log =
318335
B.pp_log_statement ~log_param_c_expr_doc:log_param_doc
@@ -443,7 +460,7 @@ module C_syntax (B : C_syntax_config) = struct
443460
let scope_prec = Lazy.force id.tn.prec in
444461
let prefix, postfix = B.convert_precision ~from:scope_prec ~to_:prec in
445462
let v_doc = string prefix ^^ string ("v" ^ Int.to_string id.scope_id) ^^ string postfix in
446-
(v_doc ^^ braces (string "=%g"), [ `Value v_doc ])
463+
(v_doc ^^ braces (string ("=" ^ B.float_log_style)), [ `Value v_doc ])
447464
| Get_global (Ops.Merge_buffer { source_node_id }, Some idcs) ->
448465
let tn = Option.value_exn ~here:[%here] @@ Tn.find ~id:source_node_id in
449466
let from_prec = Lazy.force tn.prec in
@@ -458,7 +475,7 @@ module C_syntax (B : C_syntax_config) = struct
458475
(string prefix ^^ string "merge_buffer"
459476
^^ brackets (string "%u")
460477
^^ string postfix
461-
^^ braces (string "=%g"))
478+
^^ braces (string ("=" ^ B.float_log_style)))
462479
in
463480
(expr_doc, [ `Accessor (idcs, dims); `Value access_doc ])
464481
| Get_global _ -> failwith "Exec_as_cuda: Get_global / FFI NOT IMPLEMENTED YET"
@@ -476,7 +493,7 @@ module C_syntax (B : C_syntax_config) = struct
476493
(string prefix ^^ ident_doc
477494
^^ brackets (string "%u")
478495
^^ string postfix
479-
^^ braces (string "=%g"))
496+
^^ braces (string ("=" ^ B.float_log_style)))
480497
in
481498
(expr_doc, [ `Accessor (idcs, dims); `Value access_doc ])
482499
| Constant c ->
@@ -566,15 +583,12 @@ module C_syntax (B : C_syntax_config) = struct
566583
in
567584
body :=
568585
!body ^^ string "FILE* log_file = NULL;" ^^ hardline
569-
^^ group (
570-
string ("if (" ^ log_file_var_name ^ ")") ^^ space
571-
^^ braces (
572-
nest 2 (
573-
string ("log_file = fopen(" ^ log_file_var_name ^ ", \"w\");")
574-
)
575-
)
576-
) ^^ hardline
577-
else body := !body ^^ hardline;
586+
^^ group
587+
(string ("if (" ^ log_file_var_name ^ ")")
588+
^^ space
589+
^^ braces (nest 2 (string ("log_file = fopen(" ^ log_file_var_name ^ ", \"w\");"))))
590+
^^ hardline
591+
else body := !body ^^ hardline;
578592

579593
(if Utils.debug_log_from_routines () then
580594
let debug_init_doc =

arrayjit/lib/cc_backend.ml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,9 @@ let%diagn_sexp compile ~(name : string) bindings (lowered : Low_level.optimized)
8989

9090
let use_host_memory = use_host_memory
9191
let procs = [| lowered |]
92+
let full_printf_support =
93+
not @@ Bool.of_string
94+
@@ Utils.get_global_arg ~default:"false" ~arg_name:"prefer_backend_uniformity"
9295
end)) in
9396
(* FIXME: do we really want all of them, or only the used ones? *)
9497
let idx_params = Indexing.bound_symbols bindings in
@@ -111,6 +114,10 @@ let%diagn_sexp compile_batch ~names bindings (lowereds : Low_level.optimized opt
111114

112115
let use_host_memory = use_host_memory
113116
let procs = Array.filter_opt lowereds
117+
118+
let full_printf_support =
119+
not @@ Bool.of_string
120+
@@ Utils.get_global_arg ~default:"false" ~arg_name:"prefer_backend_uniformity"
114121
end)) in
115122
(* FIXME: do we really want all of them, or only the used ones? *)
116123
let idx_params = Indexing.bound_symbols bindings in

arrayjit/lib/cuda_backend.ml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,9 @@ end) : Ir.Backend_impl.Lowered_backend = struct
264264

265265
let use_host_memory = None
266266
let procs = Input.procs
267+
let full_printf_support =
268+
not @@ Bool.of_string
269+
@@ Utils.get_global_arg ~default:"false" ~arg_name:"prefer_backend_uniformity"
267270
end)
268271

269272
let logs_to_stdout = true

arrayjit/lib/metal_backend.ml

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,7 @@ end) : Ir.Backend_impl.Lowered_backend = struct
417417

418418
let use_host_memory = use_host_memory
419419
let procs = Input.procs
420+
let full_printf_support = false
420421
end)
421422

422423
open PPrint (* Open PPrint locally *)
@@ -553,15 +554,7 @@ end) : Ir.Backend_impl.Lowered_backend = struct
553554
String.substr_replace_all base ~pattern:"\n" ~with_
554555
in
555556
let base_doc = dquotes (string base) in
556-
if List.length args_docs > 6 then
557-
(* Failsafe for "newComputePipelineStateWithFunction:options:reflection:error: failed:
558-
Compiler encountered an internal error". We could break up big log statements in
559-
C_syntax, but that's too much complexity. *)
560-
group
561-
(string metal_log_object_name
562-
^^ string ".log_debug(\"Exceeded max of 6 logging args\")"
563-
^^ semi)
564-
else if List.is_empty args_docs then
557+
if List.is_empty args_docs then
565558
group (string metal_log_object_name ^^ string ".log_debug(" ^^ base_doc ^^ rparen ^^ semi)
566559
else
567560
group

ocannl_config.example

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,4 +159,9 @@ debug_entry_id_pairs=
159159

160160
# For ppx_minidebug: for generating file names. If empty, all logging will be done to stdout,
161161
# regardless of the value of `log_main_domain_to_stdout`.
162-
log_file_stem=debug
162+
log_file_stem=debug
163+
164+
# It is useful for testing to have outputs more uniform across backends even if that criples
165+
# some backends. Currently, this setting only affects logging from routines to accomodate Metal's
166+
# shortcoming.
167+
prefer_backend_uniformity=false

test/micrograd_demo_logging-stream-0-0.expected.log

Lines changed: 39 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -6,84 +6,80 @@ float *g &[1] = 0xNNNN
66
COMMENT: g gradient update
77
COMMENT: g fwd
88
# n4_c[0] := (a[0] + b[0]);
9-
n4_c[0]{=MAYBE UNINITIALIZED} = -2 = (a[0]{=-4} + b[0]{=2})
9+
n4_c[0]{=MAYBE UNINITIALIZED} = -2000e-3 = (a[0]{=-4000e-3} + b[0]{=2000e-3})
1010
# n19_c[0] := ((n4_c[0] + n4_c[0]) + 1);
11-
n19_c[0]{=MAYBE UNINITIALIZED} = -3 = ((n4_c[0]{=-2} + n4_c[0]{=-2}) + (float)(1))
11+
n19_c[0]{=MAYBE UNINITIALIZED} = -3000e-3 = ((n4_c[0]{=-2000e-3} + n4_c[0]{=-2000e-3}) + (float)(1))
1212
# n42[0] := (b[0] - a[0]);
13-
n42[0]{=MAYBE UNINITIALIZED} = 6 = (b[0]{=2} - a[0]{=-4})
13+
n42[0]{=MAYBE UNINITIALIZED} = 6000e-3 = (b[0]{=2000e-3} - a[0]{=-4000e-3})
1414
# n31[0] := (b[0] + a[0]);
15-
n31[0]{=MAYBE UNINITIALIZED} = -2 = (b[0]{=2} + a[0]{=-4})
15+
n31[0]{=MAYBE UNINITIALIZED} = -2000e-3 = (b[0]{=2000e-3} + a[0]{=-4000e-3})
1616
# n14_d[0] := fma(a[0], b[0], (b[0] * (b[0] * b[0])));
17-
n14_d[0]{=MAYBE UNINITIALIZED} = 0 = fmaf(a[0]{=-4}, b[0]{=2}, (b[0]{=2} * (b[0]{=2} * b[0]{=2})))
17+
n14_d[0]{=MAYBE UNINITIALIZED} = 0e-3 = fma(a[0]{=-4000e-3}, b[0]{=2000e-3}, (b[0]{=2000e-3} * (b[0]{=2000e-3} * b[0]{=2000e-3})))
1818
# n40_d[0] := (fma(n14_d[0], 2, n14_d[0]) + relu(n31[0]));
19-
n40_d[0]{=MAYBE UNINITIALIZED} = 0 = (fmaf(n14_d[0]{=0}, (float)(2), n14_d[0]{=0}) + fmaxf(0.0, n31[0]{=-2}))
20-
# e[0] :=
21-
(fma(-1, a[0], ((n19_c[0] + 1) + n19_c[0])) -
22-
(fma(3, n40_d[0], n40_d[0]) + relu(n42[0])));
23-
e[0]{=MAYBE UNINITIALIZED} = -7 = (fmaf((float)(-1), a[0]{=-4}, ((n19_c[0]{=-3} + (float)(1)) + n19_c[0]{=-3})) - (fmaf((float)(3), n40_d[0]{=0}, n40_d[0]{=0}) + fmaxf(0.0, n42[0]{=6})))
19+
n40_d[0]{=MAYBE UNINITIALIZED} = 0e-3 = (fma(n14_d[0]{=0e-3}, (float)(2), n14_d[0]{=0e-3}) + max(0.0f, n31[0]{=-2000e-3}))
20+
# e[0] :=$ (fma(-1, a[0], ((n19_c[0] + 1) + n19_c[0])) -$ (fma(3, n40_d[0], n40_d[0]) + relu(n42[0])));
21+
e[0]{=MAYBE UNINITIALIZED} = -7000e-3 = (fma((float)(-1), a[0]{=-4000e-3}, ((n19_c[0]{=-3000e-3} + (float)(1)) + n19_c[0]{=-3000e-3})) - (fma((float)(3), n40_d[0]{=0e-3}, n40_d[0]{=0e-3}) + max(0.0f, n42[0]{=6000e-3})))
2422
# f[0] := (e[0] * e[0]);
25-
f[0]{=MAYBE UNINITIALIZED} = 49 = (e[0]{=-7} * e[0]{=-7})
23+
f[0]{=MAYBE UNINITIALIZED} = 49000e-3 = (e[0]{=-7000e-3} * e[0]{=-7000e-3})
2624
# g[0] := ((f[0] / 2) + (10 / f[0]));
27-
g[0]{=MAYBE UNINITIALIZED} = 24.7041 = ((f[0]{=49} / (float)(2)) + ((float)(10) / f[0]{=49}))
25+
g[0]{=MAYBE UNINITIALIZED} = 24704e-3 = ((f[0]{=49000e-3} / (float)(2)) + ((float)(10) / f[0]{=49000e-3}))
2826
COMMENT: end
2927
COMMENT: g zero grads
3028
# a_grad := 0
31-
a_grad[0]{=MAYBE UNINITIALIZED} = 0 = (float)(0)
29+
a_grad[0]{=MAYBE UNINITIALIZED} = 0e-3 = (float)(0)
3230
# b_grad := 0
33-
b_grad[0]{=MAYBE UNINITIALIZED} = 0 = (float)(0)
31+
b_grad[0]{=MAYBE UNINITIALIZED} = 0e-3 = (float)(0)
3432
# n4_c_grad := 0
35-
n4_c_grad[0]{=MAYBE UNINITIALIZED} = 0 = (float)(0)
33+
n4_c_grad[0]{=MAYBE UNINITIALIZED} = 0e-3 = (float)(0)
3634
# n19_c_grad := 0
37-
n19_c_grad[0]{=MAYBE UNINITIALIZED} = 0 = (float)(0)
35+
n19_c_grad[0]{=MAYBE UNINITIALIZED} = 0e-3 = (float)(0)
3836
# n14_d_grad := 0
39-
n14_d_grad[0]{=MAYBE UNINITIALIZED} = 0 = (float)(0)
37+
n14_d_grad[0]{=MAYBE UNINITIALIZED} = 0e-3 = (float)(0)
4038
# n40_d_grad := 0
41-
n40_d_grad[0]{=MAYBE UNINITIALIZED} = 0 = (float)(0)
39+
n40_d_grad[0]{=MAYBE UNINITIALIZED} = 0e-3 = (float)(0)
4240
# f_grad := 0
43-
f_grad[0]{=MAYBE UNINITIALIZED} = 0 = (float)(0)
41+
f_grad[0]{=MAYBE UNINITIALIZED} = 0e-3 = (float)(0)
4442
COMMENT: end
4543
COMMENT: g bprop
4644
# f.grad[0] := fma(1, (-10 / (f[0] * f[0])), f.grad[0]);
47-
f_grad[0]{=MAYBE UNINITIALIZED} = -0.00416493 = fmaf((float)(1), ((float)(-10) / (f[0]{=49} * f[0]{=49})), f_grad[0]{=0})
45+
f_grad[0]{=MAYBE UNINITIALIZED} = -4e-3 = fma((float)(1), ((float)(-10) / (f[0]{=49000e-3} * f[0]{=49000e-3})), f_grad[0]{=0e-3})
4846
# f.grad[0] := (f.grad[0] + 0.5);
49-
f_grad[0]{=MAYBE UNINITIALIZED} = 0.495835 = (f_grad[0]{=-0.00416493} + (float)(0.5))
47+
f_grad[0]{=MAYBE UNINITIALIZED} = 495e-3 = (f_grad[0]{=-4e-3} + (float)(0.5))
5048
# n40_d.grad[0] := fma(-1, ((2 * e[0]) * f.grad[0]), n40_d.grad[0]);
51-
n40_d_grad[0]{=MAYBE UNINITIALIZED} = 6.94169 = fmaf((float)(-1), (((float)(2) * e[0]{=-7}) * f_grad[0]{=0.495835}), n40_d_grad[0]{=0})
49+
n40_d_grad[0]{=MAYBE UNINITIALIZED} = 6941e-3 = fma((float)(-1), (((float)(2) * e[0]{=-7000e-3}) * f_grad[0]{=495e-3}), n40_d_grad[0]{=0e-3})
5250
# n40_d.grad[0] := fma(3, (-1 * ((2 * e[0]) * f.grad[0])), n40_d.grad[0]);
53-
n40_d_grad[0]{=MAYBE UNINITIALIZED} = 27.7668 = fmaf((float)(3), ((float)(-1) * (((float)(2) * e[0]{=-7}) * f_grad[0]{=0.495835})), n40_d_grad[0]{=6.94169})
51+
n40_d_grad[0]{=MAYBE UNINITIALIZED} = 27766e-3 = fma((float)(3), ((float)(-1) * (((float)(2) * e[0]{=-7000e-3}) * f_grad[0]{=495e-3})), n40_d_grad[0]{=6941e-3})
5452
# n14_d.grad[0] := (n14_d.grad[0] + n40_d.grad[0]);
55-
n14_d_grad[0]{=MAYBE UNINITIALIZED} = 27.7668 = (n14_d_grad[0]{=0} + n40_d_grad[0]{=27.7668})
53+
n14_d_grad[0]{=MAYBE UNINITIALIZED} = 27766e-3 = (n14_d_grad[0]{=0e-3} + n40_d_grad[0]{=27766e-3})
5654
# n14_d.grad[0] := fma(n40_d.grad[0], 2, n14_d.grad[0]);
57-
n14_d_grad[0]{=MAYBE UNINITIALIZED} = 83.3003 = fmaf(n40_d_grad[0]{=27.7668}, (float)(2), n14_d_grad[0]{=27.7668})
55+
n14_d_grad[0]{=MAYBE UNINITIALIZED} = 83300e-3 = fma(n40_d_grad[0]{=27766e-3}, (float)(2), n14_d_grad[0]{=27766e-3})
5856
# a.grad[0] := fma(n14_d.grad[0], b[0], a.grad[0]);
59-
a_grad[0]{=MAYBE UNINITIALIZED} = 166.601 = fmaf(n14_d_grad[0]{=83.3003}, b[0]{=2}, a_grad[0]{=0})
57+
a_grad[0]{=MAYBE UNINITIALIZED} = 166600e-3 = fma(n14_d_grad[0]{=83300e-3}, b[0]{=2000e-3}, a_grad[0]{=0e-3})
6058
# b.grad[0] := fma(a[0], n14_d.grad[0], b.grad[0]);
61-
b_grad[0]{=MAYBE UNINITIALIZED} = -333.201 = fmaf(a[0]{=-4}, n14_d_grad[0]{=83.3003}, b_grad[0]{=0})
59+
b_grad[0]{=MAYBE UNINITIALIZED} = -333201e-3 = fma(a[0]{=-4000e-3}, n14_d_grad[0]{=83300e-3}, b_grad[0]{=0e-3})
6260
# b.grad[0] := fma((3 * (b[0] * b[0])), n14_d.grad[0], b.grad[0]);
63-
b_grad[0]{=MAYBE UNINITIALIZED} = 666.402 = fmaf(((float)(3) * (b[0]{=2} * b[0]{=2})), n14_d_grad[0]{=83.3003}, b_grad[0]{=-333.201})
61+
b_grad[0]{=MAYBE UNINITIALIZED} = 666402e-3 = fma(((float)(3) * (b[0]{=2000e-3} * b[0]{=2000e-3})), n14_d_grad[0]{=83300e-3}, b_grad[0]{=-333201e-3})
6462
# b.grad[0] := (b.grad[0] + relu_gate(n31[0], n40_d.grad[0]));
65-
b_grad[0]{=MAYBE UNINITIALIZED} = 666.402 = (b_grad[0]{=666.402} + (n31[0]{=-2} > 0.0 ? n40_d_grad[0]{=27.7668} : 0.0))
63+
b_grad[0]{=MAYBE UNINITIALIZED} = 666402e-3 = (b_grad[0]{=666402e-3} + ((n31[0]{=-2000e-3} > 0.0f) ? n40_d_grad[0]{=27766e-3} : 0.0f))
6664
# a.grad[0] := (a.grad[0] + relu_gate(n31[0], n40_d.grad[0]));
67-
a_grad[0]{=MAYBE UNINITIALIZED} = 166.601 = (a_grad[0]{=166.601} + (n31[0]{=-2} > 0.0 ? n40_d_grad[0]{=27.7668} : 0.0))
68-
# b.grad[0] :=
69-
(b.grad[0] + relu_gate(n42[0], (-1 * ((2 * e[0]) * f.grad[0]))));
70-
b_grad[0]{=MAYBE UNINITIALIZED} = 673.344 = (b_grad[0]{=666.402} + (n42[0]{=6} > 0.0 ? ((float)(-1) * (((float)(2) * e[0]{=-7}) * f_grad[0]{=0.495835})) : 0.0))
71-
# a.grad[0] :=
72-
(a.grad[0] - relu_gate(n42[0], (-1 * ((2 * e[0]) * f.grad[0]))));
73-
a_grad[0]{=MAYBE UNINITIALIZED} = 159.659 = (a_grad[0]{=166.601} - (n42[0]{=6} > 0.0 ? ((float)(-1) * (((float)(2) * e[0]{=-7}) * f_grad[0]{=0.495835})) : 0.0))
65+
a_grad[0]{=MAYBE UNINITIALIZED} = 166600e-3 = (a_grad[0]{=166600e-3} + ((n31[0]{=-2000e-3} > 0.0f) ? n40_d_grad[0]{=27766e-3} : 0.0f))
66+
# b.grad[0] :=$ (b.grad[0] + relu_gate(n42[0], (-1 * ((2 * e[0]) * f.grad[0]))));
67+
b_grad[0]{=MAYBE UNINITIALIZED} = 673344e-3 = (b_grad[0]{=666402e-3} + ((n42[0]{=6000e-3} > 0.0f) ? ((float)(-1) * (((float)(2) * e[0]{=-7000e-3}) * f_grad[0]{=495e-3})) : 0.0f))
68+
# a.grad[0] :=$ (a.grad[0] - relu_gate(n42[0], (-1 * ((2 * e[0]) * f.grad[0]))));
69+
a_grad[0]{=MAYBE UNINITIALIZED} = 159658e-3 = (a_grad[0]{=166600e-3} - ((n42[0]{=6000e-3} > 0.0f) ? ((float)(-1) * (((float)(2) * e[0]{=-7000e-3}) * f_grad[0]{=495e-3})) : 0.0f))
7470
# n19_c.grad[0] := fma((2 * e[0]), f.grad[0], n19_c.grad[0]);
75-
n19_c_grad[0]{=MAYBE UNINITIALIZED} = -6.94169 = fmaf(((float)(2) * e[0]{=-7}), f_grad[0]{=0.495835}, n19_c_grad[0]{=0})
71+
n19_c_grad[0]{=MAYBE UNINITIALIZED} = -6941e-3 = fma(((float)(2) * e[0]{=-7000e-3}), f_grad[0]{=495e-3}, n19_c_grad[0]{=0e-3})
7672
# n19_c.grad[0] := fma((2 * e[0]), f.grad[0], n19_c.grad[0]);
77-
n19_c_grad[0]{=MAYBE UNINITIALIZED} = -13.8834 = fmaf(((float)(2) * e[0]{=-7}), f_grad[0]{=0.495835}, n19_c_grad[0]{=-6.94169})
73+
n19_c_grad[0]{=MAYBE UNINITIALIZED} = -13883e-3 = fma(((float)(2) * e[0]{=-7000e-3}), f_grad[0]{=495e-3}, n19_c_grad[0]{=-6941e-3})
7874
# n4_c.grad[0] := (n4_c.grad[0] + n19_c.grad[0]);
79-
n4_c_grad[0]{=MAYBE UNINITIALIZED} = -13.8834 = (n4_c_grad[0]{=0} + n19_c_grad[0]{=-13.8834})
75+
n4_c_grad[0]{=MAYBE UNINITIALIZED} = -13883e-3 = (n4_c_grad[0]{=0e-3} + n19_c_grad[0]{=-13883e-3})
8076
# n4_c.grad[0] := (n4_c.grad[0] + n19_c.grad[0]);
81-
n4_c_grad[0]{=MAYBE UNINITIALIZED} = -27.7668 = (n4_c_grad[0]{=-13.8834} + n19_c_grad[0]{=-13.8834})
77+
n4_c_grad[0]{=MAYBE UNINITIALIZED} = -27766e-3 = (n4_c_grad[0]{=-13883e-3} + n19_c_grad[0]{=-13883e-3})
8278
# a.grad[0] := (a.grad[0] + n4_c.grad[0]);
83-
a_grad[0]{=MAYBE UNINITIALIZED} = 131.892 = (a_grad[0]{=159.659} + n4_c_grad[0]{=-27.7668})
79+
a_grad[0]{=MAYBE UNINITIALIZED} = 131892e-3 = (a_grad[0]{=159658e-3} + n4_c_grad[0]{=-27766e-3})
8480
# b.grad[0] := (b.grad[0] + n4_c.grad[0]);
85-
b_grad[0]{=MAYBE UNINITIALIZED} = 645.577 = (b_grad[0]{=673.344} + n4_c_grad[0]{=-27.7668})
81+
b_grad[0]{=MAYBE UNINITIALIZED} = 645577e-3 = (b_grad[0]{=673344e-3} + n4_c_grad[0]{=-27766e-3})
8682
# a.grad[0] := fma(-1, ((2 * e[0]) * f.grad[0]), a.grad[0]);
87-
a_grad[0]{=MAYBE UNINITIALIZED} = 138.834 = fmaf((float)(-1), (((float)(2) * e[0]{=-7}) * f_grad[0]{=0.495835}), a_grad[0]{=131.892})
83+
a_grad[0]{=MAYBE UNINITIALIZED} = 138833e-3 = fma((float)(-1), (((float)(2) * e[0]{=-7000e-3}) * f_grad[0]{=495e-3}), a_grad[0]{=131892e-3})
8884
COMMENT: end
8985
COMMENT: end

test/ocannl_config

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ randomness_lib=for_tests
22
log_main_domain_to_stdout=true
33
backend=cc
44
log_level=0
5-
print_decimals_precision=2
5+
print_decimals_precision=2
6+
prefer_backend_uniformity=true

0 commit comments

Comments
 (0)