@@ -12,17 +12,14 @@ let get_warnings () =
1212 ! demotion_reasons
1313 |> List. dedup_and_sort ~compare: compare_demotion
1414 |> List. map ~f: (fun (linenum , pattern , msg ) ->
15- Printf. sprintf " %s (Line %i) warning: %s" (mem_name pattern) linenum
16- msg)
17-
18- let user_warning (mem_pattern : Mem_pattern.t ) (linenum : int ) (msg : string ) =
19- if not (String. is_empty msg) then
20- demotion_reasons := (linenum, mem_pattern, msg) :: ! demotion_reasons
15+ Printf. sprintf " Optimization hazard warning (Line %i): %s warning: %s"
16+ linenum (mem_name pattern) msg)
2117
2218let user_warning_op (mem_pattern : Mem_pattern.t ) (linenum : int ) (msg : string )
2319 (names : string ) =
2420 if not (String. is_empty names || String. is_empty msg) then
25- demotion_reasons := (linenum, mem_pattern, msg ^ names) :: ! demotion_reasons
21+ demotion_reasons :=
22+ (linenum, mem_pattern, msg ^ " " ^ names) :: ! demotion_reasons
2623
2724let concat_set_str (set : string Set.Poly.t ) =
2825 Set. fold
@@ -162,7 +159,7 @@ let rec query_initial_demotable_expr (in_loop : bool) (stmt_linenum : int)
162159 if is_uni_eigen_loop_indexing in_loop type_ indexed then (
163160 let single_index_set = query_var_eigen_names expr in
164161 let failure_str = concat_set_str (Set. inter acc single_index_set) in
165- let msg = " Accessed by element in a for loop: " in
162+ let msg = " Accessed by element in a for loop:" in
166163 user_warning_op SoA stmt_linenum msg failure_str;
167164 Set. union single_index_set index_set)
168165 else Set. union (query_expr acc expr) index_set in
@@ -179,7 +176,7 @@ let rec query_initial_demotable_expr (in_loop : bool) (stmt_linenum : int)
179176 if Set. is_empty full_set then full_set
180177 else
181178 let failure_str = concat_set_str (Set. inter acc full_set) in
182- let msg = " Used in a ternary operator which is not allowed: " in
179+ let msg = " Used in a ternary operator which is not allowed:" in
183180 user_warning_op SoA stmt_linenum msg failure_str;
184181 full_set
185182 | EAnd (lhs , rhs ) | EOr (lhs , rhs ) ->
@@ -225,14 +222,14 @@ and query_initial_demotable_funs (in_loop : bool) (stmt_linenum : int)
225222 let fail_names =
226223 concat_set_str (Set. inter acc top_level_eigen_names) in
227224 user_warning_op SoA stmt_linenum
228- (" Function " ^ name ^ " is not supported: " )
225+ (" Function " ^ name ^ " is not supported:" )
229226 fail_names;
230227 Set. union acc demoted_and_top_level_names))
231228 | CompilerInternal (Internal_fun. FnMakeArray | FnMakeRowVec | FnMakeTuple ) ->
232229 let fail_names =
233230 concat_set_str (Set. inter acc demoted_and_top_level_names) in
234231 user_warning_op SoA stmt_linenum
235- " Used in {} make array or make row vector compiler functions: "
232+ " Used in {} make array or make row vector compiler functions:"
236233 fail_names;
237234 Set. union acc demoted_and_top_level_names
238235 | CompilerInternal (_ : 'a Internal_fun.t ) -> acc
@@ -360,7 +357,7 @@ let rec query_initial_demotable_stmt (in_loop : bool) (acc : string Set.Poly.t)
360357 idx in
361358 match is_uni_eigen_loop_indexing in_loop ut idx with
362359 | true ->
363- user_warning_op SoA linenum " Accessed by element in a for loop: "
360+ user_warning_op SoA linenum " Accessed by element in a for loop:"
364361 (if Set. mem acc name then " " else name);
365362 Set. add idx_list name
366363 | false -> idx_list in
@@ -372,7 +369,7 @@ let rec query_initial_demotable_stmt (in_loop : bool) (acc : string Set.Poly.t)
372369 | LTupleProjection _ , _ ->
373370 let tuple_set = query_var_eigen_names rhs in
374371 let fail_set = concat_set_str tuple_set in
375- user_warning_op SoA linenum " Used in tuple: " fail_set;
372+ user_warning_op SoA linenum " Used in tuple:" fail_set;
376373 Set. add (Set. union rhs_and_idx_demotions tuple_set) name
377374 | _ -> rhs_and_idx_demotions in
378375 let assign_demotions =
@@ -407,20 +404,19 @@ let rec query_initial_demotable_stmt (in_loop : bool) (acc : string Set.Poly.t)
407404 then (
408405 let rhs_set = query_var_eigen_names rhs in
409406 let all_rhs_warn =
410- if is_all_rhs_aos then
411- " Right hand side of assignment is all AoS: "
407+ if is_all_rhs_aos then " Right hand side of assignment is all AoS:"
412408 else " " in
413409 let rhs_not_promotable_to_soa_warn =
414410 if is_rhs_not_promoteable_to_soa then
415411 " The right hand side of the assignment only contains data and \
416- scalar operations that are not promotable to SoA: "
412+ scalar operations that are not promotable to SoA:"
417413 else " " in
418414 let not_supported_func_warn =
419415 match non_supported_func_name with
420416 | Some fname ->
421417 " Function '" ^ fname
422418 ^ " ' on right hand side of assignment is not supported by \
423- SoA: "
419+ SoA:"
424420 | None -> " " in
425421 let rhs_name_set = Set. add rhs_set name in
426422 let rhs_name_set_str = concat_set_str rhs_name_set in
@@ -470,7 +466,7 @@ let rec query_initial_demotable_stmt (in_loop : bool) (acc : string Set.Poly.t)
470466 let complex_name =
471467 match SizedType. is_complex_type st with
472468 | true ->
473- user_warning_op SoA linenum " Complex-valued types cannot be SoA: "
469+ user_warning_op SoA linenum " Complex-valued types cannot be SoA:"
474470 decl_id;
475471 Set.Poly. singleton decl_id
476472 | false -> Set.Poly. empty in
@@ -503,33 +499,33 @@ let query_demotable_stmt (aos_exits : string Set.Poly.t)
503499 let all_rhs_eigen_names = query_var_eigen_names rhs in
504500 if Set. mem aos_exits assign_name then (
505501 user_warning_op SoA linenum
506- " Right hand side contains only AoS expressions: " assign_name;
502+ " Right hand side contains only AoS expressions:" assign_name;
507503 Set. add all_rhs_eigen_names assign_name)
508504 else
509505 match is_nonzero_subset ~set: aos_exits ~subset: all_rhs_eigen_names with
510506 | true ->
511- let faults = Set. inter aos_exits all_rhs_eigen_names in
512507 let warn =
513508 Fmt. (
514- str " Right hand side contains AoS expressions (%a): "
515- (list string ) (Set. to_list faults)) in
509+ str " Right hand side contains AoS expressions (%s):"
510+ (concat_set_str (Set. inter aos_exits all_rhs_eigen_names)))
511+ in
516512 user_warning_op SoA linenum warn assign_name;
517513 Set. add all_rhs_eigen_names assign_name
518514 | false -> Set.Poly. empty)
519515 | Decl {decl_id; initialize = Assign e ; _} -> (
520516 let all_rhs_eigen_names = query_var_eigen_names e in
521517 if Set. mem aos_exits decl_id then (
522518 user_warning_op SoA linenum
523- " Right hand side contains only AoS expressions: " decl_id;
519+ " Right hand side contains only AoS expressions:" decl_id;
524520 Set. add all_rhs_eigen_names decl_id)
525521 else
526522 match is_nonzero_subset ~set: aos_exits ~subset: all_rhs_eigen_names with
527523 | true ->
528- let faults = Set. inter aos_exits all_rhs_eigen_names in
529524 let warn =
530525 Fmt. (
531- str " Right hand side contains AoS expressions (%a): "
532- (list string ) (Set. to_list faults)) in
526+ str " Right hand side contains AoS expressions (%s):"
527+ (concat_set_str (Set. inter aos_exits all_rhs_eigen_names)))
528+ in
533529 user_warning_op SoA linenum warn decl_id;
534530 Set. add all_rhs_eigen_names decl_id
535531 | false -> Set.Poly. empty)
0 commit comments