kumi 0.0.23 → 0.0.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +3 -0
  3. data/README.md +2 -2
  4. data/golden/array_element/expected/schema_ruby.rb +1 -1
  5. data/golden/array_index/expected/schema_ruby.rb +1 -1
  6. data/golden/array_operations/expected/schema_ruby.rb +1 -1
  7. data/golden/cascade_logic/expected/schema_ruby.rb +1 -1
  8. data/golden/chained_fusion/expected/schema_ruby.rb +1 -1
  9. data/golden/element_arrays/expected/schema_ruby.rb +1 -1
  10. data/golden/empty_and_null_inputs/expected/schema_ruby.rb +1 -1
  11. data/golden/game_of_life/expected/lir_00_unoptimized.txt +33 -33
  12. data/golden/game_of_life/expected/lir_01_hoist_scalar_references.txt +33 -33
  13. data/golden/game_of_life/expected/lir_02_inlined.txt +296 -296
  14. data/golden/game_of_life/expected/lir_03_cse.txt +128 -128
  15. data/golden/game_of_life/expected/lir_04_1_loop_fusion.txt +128 -128
  16. data/golden/game_of_life/expected/lir_04_loop_invcm.txt +128 -128
  17. data/golden/game_of_life/expected/lir_06_const_prop.txt +128 -128
  18. data/golden/game_of_life/expected/schema_ruby.rb +1 -1
  19. data/golden/hash_keys/expected/schema_ruby.rb +1 -1
  20. data/golden/hash_keys/schema.kumi +4 -5
  21. data/golden/hash_value/expected/schema_ruby.rb +1 -1
  22. data/golden/hierarchical_complex/expected/schema_ruby.rb +1 -1
  23. data/golden/inline_rename_scope_leak/expected/ast.txt +48 -0
  24. data/golden/inline_rename_scope_leak/expected/input_plan.txt +10 -0
  25. data/golden/inline_rename_scope_leak/expected/lir_00_unoptimized.txt +35 -0
  26. data/golden/inline_rename_scope_leak/expected/lir_01_hoist_scalar_references.txt +35 -0
  27. data/golden/inline_rename_scope_leak/expected/lir_02_inlined.txt +49 -0
  28. data/golden/inline_rename_scope_leak/expected/lir_03_cse.txt +49 -0
  29. data/golden/inline_rename_scope_leak/expected/lir_04_1_loop_fusion.txt +49 -0
  30. data/golden/inline_rename_scope_leak/expected/lir_04_loop_invcm.txt +49 -0
  31. data/golden/inline_rename_scope_leak/expected/lir_06_const_prop.txt +49 -0
  32. data/golden/inline_rename_scope_leak/expected/nast.txt +31 -0
  33. data/golden/inline_rename_scope_leak/expected/schema_javascript.mjs +51 -0
  34. data/golden/inline_rename_scope_leak/expected/schema_ruby.rb +82 -0
  35. data/golden/inline_rename_scope_leak/expected/snast.txt +31 -0
  36. data/golden/inline_rename_scope_leak/expected.json +7 -0
  37. data/golden/inline_rename_scope_leak/input.json +4 -0
  38. data/golden/inline_rename_scope_leak/schema.kumi +24 -0
  39. data/golden/input_reference/expected/schema_ruby.rb +1 -1
  40. data/golden/interleaved_fusion/expected/schema_ruby.rb +1 -1
  41. data/golden/let_inline/expected/schema_ruby.rb +1 -1
  42. data/golden/loop_fusion/expected/schema_ruby.rb +1 -1
  43. data/golden/min_reduce_scope/expected/schema_ruby.rb +1 -1
  44. data/golden/mixed_dimensions/expected/schema_ruby.rb +1 -1
  45. data/golden/multirank_hoisting/expected/schema_ruby.rb +1 -1
  46. data/golden/nested_hash/expected/schema_ruby.rb +1 -1
  47. data/golden/reduction_broadcast/expected/schema_ruby.rb +1 -1
  48. data/golden/roll/expected/lir_00_unoptimized.txt +8 -8
  49. data/golden/roll/expected/lir_01_hoist_scalar_references.txt +8 -8
  50. data/golden/roll/expected/lir_02_inlined.txt +8 -8
  51. data/golden/roll/expected/lir_03_cse.txt +8 -8
  52. data/golden/roll/expected/lir_04_1_loop_fusion.txt +8 -8
  53. data/golden/roll/expected/lir_04_loop_invcm.txt +8 -8
  54. data/golden/roll/expected/lir_06_const_prop.txt +8 -8
  55. data/golden/roll/expected/schema_ruby.rb +1 -1
  56. data/golden/shift/expected/lir_00_unoptimized.txt +12 -12
  57. data/golden/shift/expected/lir_01_hoist_scalar_references.txt +12 -12
  58. data/golden/shift/expected/lir_02_inlined.txt +12 -12
  59. data/golden/shift/expected/lir_03_cse.txt +12 -12
  60. data/golden/shift/expected/lir_04_1_loop_fusion.txt +12 -12
  61. data/golden/shift/expected/lir_04_loop_invcm.txt +12 -12
  62. data/golden/shift/expected/lir_06_const_prop.txt +12 -12
  63. data/golden/shift/expected/schema_ruby.rb +1 -1
  64. data/golden/shift_2d/expected/lir_00_unoptimized.txt +48 -48
  65. data/golden/shift_2d/expected/lir_01_hoist_scalar_references.txt +48 -48
  66. data/golden/shift_2d/expected/lir_02_inlined.txt +48 -48
  67. data/golden/shift_2d/expected/lir_03_cse.txt +48 -48
  68. data/golden/shift_2d/expected/lir_04_1_loop_fusion.txt +48 -48
  69. data/golden/shift_2d/expected/lir_04_loop_invcm.txt +48 -48
  70. data/golden/shift_2d/expected/lir_06_const_prop.txt +48 -48
  71. data/golden/shift_2d/expected/schema_ruby.rb +1 -1
  72. data/golden/simple_math/expected/schema_ruby.rb +1 -1
  73. data/golden/streaming_basics/expected/schema_ruby.rb +1 -1
  74. data/golden/tuples/expected/lir_00_unoptimized.txt +4 -4
  75. data/golden/tuples/expected/lir_01_hoist_scalar_references.txt +4 -4
  76. data/golden/tuples/expected/lir_02_inlined.txt +4 -4
  77. data/golden/tuples/expected/lir_03_cse.txt +4 -4
  78. data/golden/tuples/expected/lir_04_1_loop_fusion.txt +4 -4
  79. data/golden/tuples/expected/lir_04_loop_invcm.txt +4 -4
  80. data/golden/tuples/expected/lir_06_const_prop.txt +4 -4
  81. data/golden/tuples/expected/schema_ruby.rb +1 -1
  82. data/golden/tuples_and_arrays/expected/lir_00_unoptimized.txt +1 -1
  83. data/golden/tuples_and_arrays/expected/lir_01_hoist_scalar_references.txt +1 -1
  84. data/golden/tuples_and_arrays/expected/lir_02_inlined.txt +2 -2
  85. data/golden/tuples_and_arrays/expected/lir_03_cse.txt +2 -2
  86. data/golden/tuples_and_arrays/expected/lir_04_1_loop_fusion.txt +2 -2
  87. data/golden/tuples_and_arrays/expected/lir_04_loop_invcm.txt +2 -2
  88. data/golden/tuples_and_arrays/expected/lir_06_const_prop.txt +2 -2
  89. data/golden/tuples_and_arrays/expected/schema_ruby.rb +1 -1
  90. data/golden/us_tax_2024/expected/ast.txt +865 -0
  91. data/golden/us_tax_2024/expected/input_plan.txt +61 -0
  92. data/golden/us_tax_2024/expected/lir_00_unoptimized.txt +901 -0
  93. data/golden/us_tax_2024/expected/lir_01_hoist_scalar_references.txt +901 -0
  94. data/golden/us_tax_2024/expected/lir_02_inlined.txt +5178 -0
  95. data/golden/us_tax_2024/expected/lir_03_cse.txt +2499 -0
  96. data/golden/us_tax_2024/expected/lir_04_1_loop_fusion.txt +2519 -0
  97. data/golden/us_tax_2024/expected/lir_04_loop_invcm.txt +2439 -0
  98. data/golden/us_tax_2024/expected/lir_06_const_prop.txt +2439 -0
  99. data/golden/us_tax_2024/expected/nast.txt +976 -0
  100. data/golden/us_tax_2024/expected/schema_javascript.mjs +584 -0
  101. data/golden/us_tax_2024/expected/schema_ruby.rb +639 -0
  102. data/golden/us_tax_2024/expected/snast.txt +976 -0
  103. data/golden/us_tax_2024/expected.json +1 -0
  104. data/golden/us_tax_2024/input.json +168 -0
  105. data/golden/us_tax_2024/schema.kumi +203 -0
  106. data/golden/with_constants/expected/schema_ruby.rb +1 -1
  107. data/lib/kumi/core/analyzer/passes/lir/inline_declarations_pass.rb +181 -105
  108. data/lib/kumi/version.rb +1 -1
  109. metadata +33 -1
@@ -1,5 +1,5 @@
1
1
  # Autogenerated by Kumi Codegen
2
- module Kumi::Compiled::KUMI_bd17a3ebee1bec4e58b72118d43e8c1c93bf773f257fc93d9c32a783d212ea4f
2
+ module Kumi::Compiled::KUMI_7f8da9f72da44456b53831adb45862195177b23a6de44ddaeb2f4548d3a03763
3
3
  def self.from(input_data = nil)
4
4
  instance = Object.new
5
5
  instance.extend(self)
@@ -1,5 +1,5 @@
1
1
  # Autogenerated by Kumi Codegen
2
- module Kumi::Compiled::KUMI_de2ffb31562b045a19801b8e458c5b0da73644202388cc9edde9e77ef79a031d
2
+ module Kumi::Compiled::KUMI_6bf7bc7a8b5aa3100171c0cfb98b3fbd85a8044bd3561af65115d0ed6c7d7656
3
3
  def self.from(input_data = nil)
4
4
  instance = Object.new
5
5
  instance.extend(self)
@@ -1,14 +1,13 @@
1
1
  schema do
2
-
3
2
  input do
4
3
  integer :width
5
4
  integer :height
6
5
  end
7
6
 
8
7
  value :meta, {
9
- render: "grid2d",
10
- size: { width: input.width, height: input.height },
8
+ render: "grid2d",
9
+ size: { width: input.width, height: input.height },
11
10
  prefill: { kind: "random", density: 0.3 },
12
- ui: { cellSize: 10, palette: { "0" => "#0f1219", "1" => "#10b981" } }
11
+ ui: { cellSize: 10, palette: { "0" => "#0f1219", "1" => "#10b981" } }
13
12
  }
14
- end
13
+ end
@@ -1,5 +1,5 @@
1
1
  # Autogenerated by Kumi Codegen
2
- module Kumi::Compiled::KUMI_a4a074e8debe747cbfaabedfd7082570fa83ea16e2b45242ee69280227ba2110
2
+ module Kumi::Compiled::KUMI_c643326a905412f8383dfdf5434a76da6946aa8f7d89002f06aa830abb137d5e
3
3
  def self.from(input_data = nil)
4
4
  instance = Object.new
5
5
  instance.extend(self)
@@ -1,5 +1,5 @@
1
1
  # Autogenerated by Kumi Codegen
2
- module Kumi::Compiled::KUMI_c564c8cb0e8f3b1664084790b1d9c36eaf7d0cbbee56b7211f752b8a2bfa8a8d
2
+ module Kumi::Compiled::KUMI_c432011fb1d3ae36f896bdc610664fb1e3aed88af214541fcb7fd8eff10c6df8
3
3
  def self.from(input_data = nil)
4
4
  instance = Object.new
5
5
  instance.extend(self)
@@ -0,0 +1,48 @@
1
+ (Root
2
+ inputs: [
3
+ (InputDeclaration :xs :array
4
+ [
5
+ (InputDeclaration :el :hash
6
+ [
7
+ (InputDeclaration :v :float)
8
+ ]
9
+ )
10
+ ]
11
+ )
12
+ (InputDeclaration :ys :array
13
+ [
14
+ (InputDeclaration :el :hash
15
+ [
16
+ (InputDeclaration :v :float)
17
+ ]
18
+ )
19
+ ]
20
+ )
21
+ ]
22
+ values: [
23
+ (ValueDeclaration :sum_x
24
+ (CallExpression :sum
25
+ (InputElementReference xs.el.v)
26
+ )
27
+ )
28
+ (ValueDeclaration :sum_y
29
+ (CallExpression :sum
30
+ (InputElementReference ys.el.v)
31
+ )
32
+ )
33
+ (ValueDeclaration :tail
34
+ (CallExpression :add
35
+ (Literal 7.0)
36
+ (Literal 5.0)
37
+ )
38
+ )
39
+ (ValueDeclaration :out
40
+ (HashExpression
41
+ ((Literal :x) (DeclarationReference :sum_x))
42
+ ((Literal :y) (DeclarationReference :sum_y))
43
+ ((Literal :t) (DeclarationReference :tail))
44
+ )
45
+ )
46
+ ]
47
+ traits: []
48
+ )
@@ -0,0 +1,10 @@
1
+ xs: array (array) access_mode=element
2
+ └─> el: element_access
3
+ el: hash (hash)
4
+ └─> v: property_access
5
+ v: float
6
+ ys: array (array) access_mode=element
7
+ └─> el: element_access
8
+ el: hash (hash)
9
+ └─> v: property_access
10
+ v: float
@@ -0,0 +1,35 @@
1
+ (LIR
2
+ (Declaration sum_x
3
+ %acc_1 = decl_acc :: float
4
+ %t2 = load_input "xs" :: array
5
+ loop xs id=L1 in %t2 as el=%xs_el_3, idx=%xs_i_4
6
+ %t5 = load_field xs_el_3["v"] :: float
7
+ %acc_1 = acc_add agg.sum(%acc_1, %t5) :: float
8
+ end_loop
9
+ %t6 = acc_load %acc_1 :: float
10
+ yield %t6
11
+ )
12
+ (Declaration sum_y
13
+ %acc_7 = decl_acc :: float
14
+ %t8 = load_input "ys" :: array
15
+ loop ys id=L2 in %t8 as el=%ys_el_9, idx=%ys_i_10
16
+ %t11 = load_field ys_el_9["v"] :: float
17
+ %acc_7 = acc_add agg.sum(%acc_7, %t11) :: float
18
+ end_loop
19
+ %t12 = acc_load %acc_7 :: float
20
+ yield %t12
21
+ )
22
+ (Declaration tail
23
+ %t13 = const 7.0 :: float
24
+ %t14 = const 5.0 :: float
25
+ %t15 = call core.add(%t13, %t14) :: float
26
+ yield %t15
27
+ )
28
+ (Declaration out
29
+ %t16 = load_decl sum_x :: float
30
+ %t17 = load_decl sum_y :: float
31
+ %t18 = load_decl tail :: float
32
+ %t19 = make_object{x: %t16, y: %t17, t: %t18} :: object
33
+ yield %t19
34
+ )
35
+ )
@@ -0,0 +1,35 @@
1
+ (LIR
2
+ (Declaration sum_x
3
+ %acc_1 = decl_acc :: float
4
+ %t2 = load_input "xs" :: array
5
+ loop xs id=L1 in %t2 as el=%xs_el_3, idx=%xs_i_4
6
+ %t5 = load_field xs_el_3["v"] :: float
7
+ %acc_1 = acc_add agg.sum(%acc_1, %t5) :: float
8
+ end_loop
9
+ %t6 = acc_load %acc_1 :: float
10
+ yield %t6
11
+ )
12
+ (Declaration sum_y
13
+ %acc_7 = decl_acc :: float
14
+ %t8 = load_input "ys" :: array
15
+ loop ys id=L2 in %t8 as el=%ys_el_9, idx=%ys_i_10
16
+ %t11 = load_field ys_el_9["v"] :: float
17
+ %acc_7 = acc_add agg.sum(%acc_7, %t11) :: float
18
+ end_loop
19
+ %t12 = acc_load %acc_7 :: float
20
+ yield %t12
21
+ )
22
+ (Declaration tail
23
+ %t13 = const 7.0 :: float
24
+ %t14 = const 5.0 :: float
25
+ %t15 = call core.add(%t13, %t14) :: float
26
+ yield %t15
27
+ )
28
+ (Declaration out
29
+ %t16 = load_decl sum_x :: float
30
+ %t17 = load_decl sum_y :: float
31
+ %t18 = load_decl tail :: float
32
+ %t19 = make_object{x: %t16, y: %t17, t: %t18} :: object
33
+ yield %t19
34
+ )
35
+ )
@@ -0,0 +1,49 @@
1
+ (LIR
2
+ (Declaration sum_x
3
+ %acc_1 = decl_acc :: float
4
+ %t2 = load_input "xs" :: array
5
+ loop xs id=L1 in %t2 as el=%xs_el_3, idx=%xs_i_4
6
+ %t5 = load_field xs_el_3["v"] :: float
7
+ %acc_1 = acc_add agg.sum(%acc_1, %t5) :: float
8
+ end_loop
9
+ %t6 = acc_load %acc_1 :: float
10
+ yield %t6
11
+ )
12
+ (Declaration sum_y
13
+ %acc_7 = decl_acc :: float
14
+ %t8 = load_input "ys" :: array
15
+ loop ys id=L2 in %t8 as el=%ys_el_9, idx=%ys_i_10
16
+ %t11 = load_field ys_el_9["v"] :: float
17
+ %acc_7 = acc_add agg.sum(%acc_7, %t11) :: float
18
+ end_loop
19
+ %t12 = acc_load %acc_7 :: float
20
+ yield %t12
21
+ )
22
+ (Declaration tail
23
+ %t13 = const 7.0 :: float
24
+ %t14 = const 5.0 :: float
25
+ %t15 = call core.add(%t13, %t14) :: float
26
+ yield %t15
27
+ )
28
+ (Declaration out
29
+ %acc21 = decl_acc :: float
30
+ %t22 = load_input "xs" :: array
31
+ loop xs id=L3 in %t22 as el=%t23, idx=%t24
32
+ %t25 = load_field t23["v"] :: float
33
+ %acc21 = acc_add agg.sum(%acc21, %t25) :: float
34
+ end_loop
35
+ %t26 = acc_load %acc21 :: float
36
+ %acc28 = decl_acc :: float
37
+ %t29 = load_input "ys" :: array
38
+ loop ys id=L4 in %t29 as el=%t30, idx=%t31
39
+ %t32 = load_field t30["v"] :: float
40
+ %acc28 = acc_add agg.sum(%acc28, %t32) :: float
41
+ end_loop
42
+ %t33 = acc_load %acc28 :: float
43
+ %t34 = const 7.0 :: float
44
+ %t35 = const 5.0 :: float
45
+ %t36 = call core.add(%t34, %t35) :: float
46
+ %t19 = make_object{x: %t26, y: %t33, t: %t36} :: object
47
+ yield %t19
48
+ )
49
+ )
@@ -0,0 +1,49 @@
1
+ (LIR
2
+ (Declaration sum_x
3
+ %acc_1 = decl_acc :: float
4
+ %t2 = load_input "xs" :: array
5
+ loop xs id=L1 in %t2 as el=%xs_el_3, idx=%xs_i_4
6
+ %t5 = load_field xs_el_3["v"] :: float
7
+ %acc_1 = acc_add agg.sum(%acc_1, %t5) :: float
8
+ end_loop
9
+ %t6 = acc_load %acc_1 :: float
10
+ yield %t6
11
+ )
12
+ (Declaration sum_y
13
+ %acc_7 = decl_acc :: float
14
+ %t8 = load_input "ys" :: array
15
+ loop ys id=L2 in %t8 as el=%ys_el_9, idx=%ys_i_10
16
+ %t11 = load_field ys_el_9["v"] :: float
17
+ %acc_7 = acc_add agg.sum(%acc_7, %t11) :: float
18
+ end_loop
19
+ %t12 = acc_load %acc_7 :: float
20
+ yield %t12
21
+ )
22
+ (Declaration tail
23
+ %t13 = const 7.0 :: float
24
+ %t14 = const 5.0 :: float
25
+ %t15 = call core.add(%t13, %t14) :: float
26
+ yield %t15
27
+ )
28
+ (Declaration out
29
+ %acc21 = decl_acc :: float
30
+ %t22 = load_input "xs" :: array
31
+ loop xs id=L3 in %t22 as el=%t23, idx=%t24
32
+ %t25 = load_field t23["v"] :: float
33
+ %acc21 = acc_add agg.sum(%acc21, %t25) :: float
34
+ end_loop
35
+ %t26 = acc_load %acc21 :: float
36
+ %acc28 = decl_acc :: float
37
+ %t29 = load_input "ys" :: array
38
+ loop ys id=L4 in %t29 as el=%t30, idx=%t31
39
+ %t32 = load_field t30["v"] :: float
40
+ %acc28 = acc_add agg.sum(%acc28, %t32) :: float
41
+ end_loop
42
+ %t33 = acc_load %acc28 :: float
43
+ %t34 = const 7.0 :: float
44
+ %t35 = const 5.0 :: float
45
+ %t36 = call core.add(%t34, %t35) :: float
46
+ %t19 = make_object{x: %t26, y: %t33, t: %t36} :: object
47
+ yield %t19
48
+ )
49
+ )
@@ -0,0 +1,49 @@
1
+ (LIR
2
+ (Declaration sum_x
3
+ %acc_1 = decl_acc :: float
4
+ %t2 = load_input "xs" :: array
5
+ loop xs id=L1 in %t2 as el=%xs_el_3, idx=%xs_i_4
6
+ %t5 = load_field xs_el_3["v"] :: float
7
+ %acc_1 = acc_add agg.sum(%acc_1, %t5) :: float
8
+ end_loop
9
+ %t6 = acc_load %acc_1 :: float
10
+ yield %t6
11
+ )
12
+ (Declaration sum_y
13
+ %acc_7 = decl_acc :: float
14
+ %t8 = load_input "ys" :: array
15
+ loop ys id=L2 in %t8 as el=%ys_el_9, idx=%ys_i_10
16
+ %t11 = load_field ys_el_9["v"] :: float
17
+ %acc_7 = acc_add agg.sum(%acc_7, %t11) :: float
18
+ end_loop
19
+ %t12 = acc_load %acc_7 :: float
20
+ yield %t12
21
+ )
22
+ (Declaration tail
23
+ %t13 = const 7.0 :: float
24
+ %t14 = const 5.0 :: float
25
+ %t15 = call core.add(%t13, %t14) :: float
26
+ yield %t15
27
+ )
28
+ (Declaration out
29
+ %acc21 = decl_acc :: float
30
+ %t22 = load_input "xs" :: array
31
+ loop xs id=L3 in %t22 as el=%t23, idx=%t24
32
+ %t25 = load_field t23["v"] :: float
33
+ %acc21 = acc_add agg.sum(%acc21, %t25) :: float
34
+ end_loop
35
+ %t26 = acc_load %acc21 :: float
36
+ %acc28 = decl_acc :: float
37
+ %t29 = load_input "ys" :: array
38
+ loop ys id=L4 in %t29 as el=%t30, idx=%t31
39
+ %t32 = load_field t30["v"] :: float
40
+ %acc28 = acc_add agg.sum(%acc28, %t32) :: float
41
+ end_loop
42
+ %t33 = acc_load %acc28 :: float
43
+ %t34 = const 7.0 :: float
44
+ %t35 = const 5.0 :: float
45
+ %t36 = call core.add(%t34, %t35) :: float
46
+ %t19 = make_object{x: %t26, y: %t33, t: %t36} :: object
47
+ yield %t19
48
+ )
49
+ )
@@ -0,0 +1,49 @@
1
+ (LIR
2
+ (Declaration sum_x
3
+ %acc_1 = decl_acc :: float
4
+ %t2 = load_input "xs" :: array
5
+ loop xs id=L1 in %t2 as el=%xs_el_3, idx=%xs_i_4
6
+ %t5 = load_field xs_el_3["v"] :: float
7
+ %acc_1 = acc_add agg.sum(%acc_1, %t5) :: float
8
+ end_loop
9
+ %t6 = acc_load %acc_1 :: float
10
+ yield %t6
11
+ )
12
+ (Declaration sum_y
13
+ %acc_7 = decl_acc :: float
14
+ %t8 = load_input "ys" :: array
15
+ loop ys id=L2 in %t8 as el=%ys_el_9, idx=%ys_i_10
16
+ %t11 = load_field ys_el_9["v"] :: float
17
+ %acc_7 = acc_add agg.sum(%acc_7, %t11) :: float
18
+ end_loop
19
+ %t12 = acc_load %acc_7 :: float
20
+ yield %t12
21
+ )
22
+ (Declaration tail
23
+ %t13 = const 7.0 :: float
24
+ %t14 = const 5.0 :: float
25
+ %t15 = call core.add(%t13, %t14) :: float
26
+ yield %t15
27
+ )
28
+ (Declaration out
29
+ %acc21 = decl_acc :: float
30
+ %t22 = load_input "xs" :: array
31
+ loop xs id=L3 in %t22 as el=%t23, idx=%t24
32
+ %t25 = load_field t23["v"] :: float
33
+ %acc21 = acc_add agg.sum(%acc21, %t25) :: float
34
+ end_loop
35
+ %t26 = acc_load %acc21 :: float
36
+ %acc28 = decl_acc :: float
37
+ %t29 = load_input "ys" :: array
38
+ loop ys id=L4 in %t29 as el=%t30, idx=%t31
39
+ %t32 = load_field t30["v"] :: float
40
+ %acc28 = acc_add agg.sum(%acc28, %t32) :: float
41
+ end_loop
42
+ %t33 = acc_load %acc28 :: float
43
+ %t34 = const 7.0 :: float
44
+ %t35 = const 5.0 :: float
45
+ %t36 = call core.add(%t34, %t35) :: float
46
+ %t19 = make_object{x: %t26, y: %t33, t: %t36} :: object
47
+ yield %t19
48
+ )
49
+ )
@@ -0,0 +1,49 @@
1
+ (LIR
2
+ (Declaration sum_x
3
+ %acc_1 = decl_acc :: float
4
+ %t2 = load_input "xs" :: array
5
+ loop xs id=L1 in %t2 as el=%xs_el_3, idx=%xs_i_4
6
+ %t5 = load_field xs_el_3["v"] :: float
7
+ %acc_1 = acc_add agg.sum(%acc_1, %t5) :: float
8
+ end_loop
9
+ %t6 = acc_load %acc_1 :: float
10
+ yield %t6
11
+ )
12
+ (Declaration sum_y
13
+ %acc_7 = decl_acc :: float
14
+ %t8 = load_input "ys" :: array
15
+ loop ys id=L2 in %t8 as el=%ys_el_9, idx=%ys_i_10
16
+ %t11 = load_field ys_el_9["v"] :: float
17
+ %acc_7 = acc_add agg.sum(%acc_7, %t11) :: float
18
+ end_loop
19
+ %t12 = acc_load %acc_7 :: float
20
+ yield %t12
21
+ )
22
+ (Declaration tail
23
+ %t13 = const 7.0 :: float
24
+ %t14 = const 5.0 :: float
25
+ %t15 = call core.add(%t13, %t14) :: float
26
+ yield %t15
27
+ )
28
+ (Declaration out
29
+ %acc21 = decl_acc :: float
30
+ %t22 = load_input "xs" :: array
31
+ loop xs id=L3 in %t22 as el=%t23, idx=%t24
32
+ %t25 = load_field t23["v"] :: float
33
+ %acc21 = acc_add agg.sum(%acc21, %t25) :: float
34
+ end_loop
35
+ %t26 = acc_load %acc21 :: float
36
+ %acc28 = decl_acc :: float
37
+ %t29 = load_input "ys" :: array
38
+ loop ys id=L4 in %t29 as el=%t30, idx=%t31
39
+ %t32 = load_field t30["v"] :: float
40
+ %acc28 = acc_add agg.sum(%acc28, %t32) :: float
41
+ end_loop
42
+ %t33 = acc_load %acc28 :: float
43
+ %t34 = const 7.0 :: float
44
+ %t35 = const 5.0 :: float
45
+ %t36 = call core.add(%t34, %t35) :: float
46
+ %t19 = make_object{x: %t26, y: %t33, t: %t36} :: object
47
+ yield %t19
48
+ )
49
+ )
@@ -0,0 +1,31 @@
1
+ (NAST
2
+ (VALUE sum_x
3
+ (Call :"agg.sum"
4
+ (InputRef [:xs, :el, :v])
5
+ )
6
+ )
7
+ (VALUE sum_y
8
+ (Call :"agg.sum"
9
+ (InputRef [:ys, :el, :v])
10
+ )
11
+ )
12
+ (VALUE tail
13
+ (Call :"core.add"
14
+ (Const 7.0)
15
+ (Const 5.0)
16
+ )
17
+ )
18
+ (VALUE out
19
+ (Hash
20
+ (Pair x
21
+ (Ref sum_x)
22
+ )
23
+ (Pair y
24
+ (Ref sum_y)
25
+ )
26
+ (Pair t
27
+ (Ref tail)
28
+ )
29
+ )
30
+ )
31
+ )
@@ -0,0 +1,51 @@
1
+ export function _sum_x(input) {
2
+ let acc_1 = 0.0;
3
+ let t2 = input["xs"];
4
+ t2.forEach((xs_el_3, xs_i_4) => {
5
+ let t5 = xs_el_3["v"];
6
+ acc_1 += t5;
7
+ });
8
+ return acc_1;
9
+ }
10
+
11
+ export function _sum_y(input) {
12
+ let acc_7 = 0.0;
13
+ let t8 = input["ys"];
14
+ t8.forEach((ys_el_9, ys_i_10) => {
15
+ let t11 = ys_el_9["v"];
16
+ acc_7 += t11;
17
+ });
18
+ return acc_7;
19
+ }
20
+
21
+ export function _tail(input) {
22
+ const t13 = 7.0;
23
+ const t14 = 5.0;
24
+ let t15 = t13 + t14;
25
+ return t15;
26
+ }
27
+
28
+ export function _out(input) {
29
+ let acc21 = 0.0;
30
+ let t22 = input["xs"];
31
+ t22.forEach((t23, t24) => {
32
+ let t25 = t23["v"];
33
+ acc21 += t25;
34
+ });
35
+ let acc28 = 0.0;
36
+ let t29 = input["ys"];
37
+ t29.forEach((t30, t31) => {
38
+ let t32 = t30["v"];
39
+ acc28 += t32;
40
+ });
41
+ const t34 = 7.0;
42
+ const t35 = 5.0;
43
+ let t36 = t34 + t35;
44
+ let t19 = {
45
+ "x": acc21,
46
+ "y": acc28,
47
+ "t": t36
48
+ };
49
+ return t19;
50
+ }
51
+
@@ -0,0 +1,82 @@
1
+ # Autogenerated by Kumi Codegen
2
+ module Kumi::Compiled::KUMI_9a60dec6b5eb1f59d7068a0904801dc4a6fd6ec93ba01d65f442c70b60be09b2
3
+ def self.from(input_data = nil)
4
+ instance = Object.new
5
+ instance.extend(self)
6
+ instance.instance_variable_set(:@input, input_data)
7
+ instance
8
+ end
9
+
10
+ def self.__kumi_executable__
11
+ instance = Object.new
12
+ instance.extend(self)
13
+ instance
14
+ end
15
+
16
+ def update(input_data)
17
+ @input = @input.merge(input_data)
18
+ self
19
+ end
20
+
21
+ def [](name)
22
+ case name
23
+ when :sum_x then _sum_x
24
+ when :sum_y then _sum_y
25
+ when :tail then _tail
26
+ when :out then _out
27
+ else raise KeyError, "Unknown declaration"
28
+ end
29
+ end
30
+
31
+ def _sum_x(input = @input)
32
+ acc_1 = 0.0
33
+ t2 = input["xs"] || input[:xs]
34
+ t2.each_with_index do |xs_el_3, xs_i_4|
35
+ t5 = xs_el_3["v"] || xs_el_3[:v]
36
+ acc_1 += t5
37
+ end
38
+ acc_1
39
+ end
40
+
41
+ def _sum_y(input = @input)
42
+ acc_7 = 0.0
43
+ t8 = input["ys"] || input[:ys]
44
+ t8.each_with_index do |ys_el_9, ys_i_10|
45
+ t11 = ys_el_9["v"] || ys_el_9[:v]
46
+ acc_7 += t11
47
+ end
48
+ acc_7
49
+ end
50
+
51
+ def _tail(input = @input)
52
+ t13 = 7.0
53
+ t14 = 5.0
54
+ t13 + t14
55
+ end
56
+
57
+ def _out(input = @input)
58
+ acc21 = 0.0
59
+ t22 = input["xs"] || input[:xs]
60
+ t22.each_with_index do |t23, t24|
61
+ t25 = t23["v"] || t23[:v]
62
+ acc21 += t25
63
+ end
64
+ t26 = acc21
65
+ acc28 = 0.0
66
+ t29 = input["ys"] || input[:ys]
67
+ t29.each_with_index do |t30, t31|
68
+ t32 = t30["v"] || t30[:v]
69
+ acc28 += t32
70
+ end
71
+ t33 = acc28
72
+ t34 = 7.0
73
+ t35 = 5.0
74
+ t36 = t34 + t35
75
+ t19 = {
76
+ "x" => t26,
77
+ "y" => t33,
78
+ "t" => t36
79
+ }
80
+ t19
81
+ end
82
+ end
@@ -0,0 +1,31 @@
1
+ (SNAST
2
+ (VALUE sum_x
3
+ (Reduce :agg.sum over [xs]
4
+ (InputRef xs.el.v key_chain=[]) :: [xs] -> float
5
+ ) :: [] -> float
6
+ ) :: [] -> float
7
+ (VALUE sum_y
8
+ (Reduce :agg.sum over [ys]
9
+ (InputRef ys.el.v key_chain=[]) :: [ys] -> float
10
+ ) :: [] -> float
11
+ ) :: [] -> float
12
+ (VALUE tail
13
+ (Call :core.add
14
+ (Const 7.0) :: [] -> float
15
+ (Const 5.0) :: [] -> float
16
+ ) :: [] -> float
17
+ ) :: [] -> float
18
+ (VALUE out
19
+ (Hash
20
+ (Pair x
21
+ (Ref sum_x) :: [] -> float
22
+ ) :: [] -> pair
23
+ (Pair y
24
+ (Ref sum_y) :: [] -> float
25
+ ) :: [] -> pair
26
+ (Pair t
27
+ (Ref tail) :: [] -> float
28
+ ) :: [] -> pair
29
+ ) :: [] -> hash
30
+ ) :: [] -> hash
31
+ )
@@ -0,0 +1,7 @@
1
+ {
2
+ "out": {
3
+ "x": 6.0,
4
+ "y": 30.0,
5
+ "t": 12.0
6
+ }
7
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "xs": [ { "v": 1.0 } , { "v": 2.0 } , { "v": 3.0 } ],
3
+ "ys": [ { "v": 10.0 }, { "v": 20.0 } ]
4
+ }
@@ -0,0 +1,24 @@
1
+ schema do
2
+ input do
3
+ array :xs do
4
+ hash :el do
5
+ float :v
6
+ end
7
+ end
8
+ array :ys do
9
+ hash :el do
10
+ float :v
11
+ end
12
+ end
13
+ end
14
+
15
+ # two separate decls that each compile to a gamma (sum over array)
16
+ value :sum_x, fn(:sum, input.xs.el.v)
17
+ value :sum_y, fn(:sum, input.ys.el.v)
18
+
19
+ # unrelated scalar decl
20
+ value :tail, 7.0 + 5.0
21
+
22
+ # caller that forces two LoadDeclaration inlines, then a scalar op
23
+ value :out, { x: sum_x, y: sum_y, t: tail }
24
+ end
@@ -1,5 +1,5 @@
1
1
  # Autogenerated by Kumi Codegen
2
- module Kumi::Compiled::KUMI_553e66837fe392a06e5de16b6bc32e442b3e71b92f205eae1451b78a49fbac83
2
+ module Kumi::Compiled::KUMI_18db5064becd4a4342d6c7c48a3f0f9be709904986f6c53a0fd9ead2270302fc
3
3
  def self.from(input_data = nil)
4
4
  instance = Object.new
5
5
  instance.extend(self)
@@ -1,5 +1,5 @@
1
1
  # Autogenerated by Kumi Codegen
2
- module Kumi::Compiled::KUMI_1523dc98fbf6f178f956575880c9b428b21c19aa91a7822a35e277983da843a8
2
+ module Kumi::Compiled::KUMI_439c5f78b9f09ead0135b22b7e3f99b28fbd8f9cf85471d95331a49b288eadf7
3
3
  def self.from(input_data = nil)
4
4
  instance = Object.new
5
5
  instance.extend(self)