kumi 0.0.22 → 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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/README.md +60 -116
- data/golden/array_element/expected/schema_ruby.rb +1 -1
- data/golden/array_index/expected/schema_ruby.rb +1 -1
- data/golden/array_operations/expected/schema_ruby.rb +1 -1
- data/golden/cascade_logic/expected/schema_ruby.rb +1 -1
- data/golden/chained_fusion/expected/schema_ruby.rb +1 -1
- data/golden/element_arrays/expected/schema_ruby.rb +1 -1
- data/golden/empty_and_null_inputs/expected/schema_ruby.rb +1 -1
- data/golden/game_of_life/expected/lir_00_unoptimized.txt +33 -33
- data/golden/game_of_life/expected/lir_01_hoist_scalar_references.txt +33 -33
- data/golden/game_of_life/expected/lir_02_inlined.txt +296 -296
- data/golden/game_of_life/expected/lir_03_cse.txt +128 -128
- data/golden/game_of_life/expected/lir_04_1_loop_fusion.txt +128 -128
- data/golden/game_of_life/expected/lir_04_loop_invcm.txt +128 -128
- data/golden/game_of_life/expected/lir_06_const_prop.txt +128 -128
- data/golden/game_of_life/expected/schema_ruby.rb +1 -1
- data/golden/hash_keys/expected/schema_ruby.rb +1 -1
- data/golden/hash_keys/schema.kumi +4 -5
- data/golden/hash_value/expected/schema_ruby.rb +1 -1
- data/golden/hierarchical_complex/expected/schema_ruby.rb +1 -1
- data/golden/inline_rename_scope_leak/expected/ast.txt +48 -0
- data/golden/inline_rename_scope_leak/expected/input_plan.txt +10 -0
- data/golden/inline_rename_scope_leak/expected/lir_00_unoptimized.txt +35 -0
- data/golden/inline_rename_scope_leak/expected/lir_01_hoist_scalar_references.txt +35 -0
- data/golden/inline_rename_scope_leak/expected/lir_02_inlined.txt +49 -0
- data/golden/inline_rename_scope_leak/expected/lir_03_cse.txt +49 -0
- data/golden/inline_rename_scope_leak/expected/lir_04_1_loop_fusion.txt +49 -0
- data/golden/inline_rename_scope_leak/expected/lir_04_loop_invcm.txt +49 -0
- data/golden/inline_rename_scope_leak/expected/lir_06_const_prop.txt +49 -0
- data/golden/inline_rename_scope_leak/expected/nast.txt +31 -0
- data/golden/inline_rename_scope_leak/expected/schema_javascript.mjs +51 -0
- data/golden/inline_rename_scope_leak/expected/schema_ruby.rb +82 -0
- data/golden/inline_rename_scope_leak/expected/snast.txt +31 -0
- data/golden/inline_rename_scope_leak/expected.json +7 -0
- data/golden/inline_rename_scope_leak/input.json +4 -0
- data/golden/inline_rename_scope_leak/schema.kumi +24 -0
- data/golden/input_reference/expected/schema_ruby.rb +1 -1
- data/golden/interleaved_fusion/expected/schema_ruby.rb +1 -1
- data/golden/let_inline/expected/schema_ruby.rb +1 -1
- data/golden/loop_fusion/expected/schema_ruby.rb +1 -1
- data/golden/min_reduce_scope/expected/schema_ruby.rb +1 -1
- data/golden/mixed_dimensions/expected/schema_ruby.rb +1 -1
- data/golden/multirank_hoisting/expected/schema_ruby.rb +1 -1
- data/golden/nested_hash/expected/schema_ruby.rb +1 -1
- data/golden/reduction_broadcast/expected/schema_ruby.rb +1 -1
- data/golden/roll/expected/lir_00_unoptimized.txt +8 -8
- data/golden/roll/expected/lir_01_hoist_scalar_references.txt +8 -8
- data/golden/roll/expected/lir_02_inlined.txt +8 -8
- data/golden/roll/expected/lir_03_cse.txt +8 -8
- data/golden/roll/expected/lir_04_1_loop_fusion.txt +8 -8
- data/golden/roll/expected/lir_04_loop_invcm.txt +8 -8
- data/golden/roll/expected/lir_06_const_prop.txt +8 -8
- data/golden/roll/expected/schema_ruby.rb +1 -1
- data/golden/shift/expected/lir_00_unoptimized.txt +12 -12
- data/golden/shift/expected/lir_01_hoist_scalar_references.txt +12 -12
- data/golden/shift/expected/lir_02_inlined.txt +12 -12
- data/golden/shift/expected/lir_03_cse.txt +12 -12
- data/golden/shift/expected/lir_04_1_loop_fusion.txt +12 -12
- data/golden/shift/expected/lir_04_loop_invcm.txt +12 -12
- data/golden/shift/expected/lir_06_const_prop.txt +12 -12
- data/golden/shift/expected/schema_ruby.rb +1 -1
- data/golden/shift_2d/expected/lir_00_unoptimized.txt +48 -48
- data/golden/shift_2d/expected/lir_01_hoist_scalar_references.txt +48 -48
- data/golden/shift_2d/expected/lir_02_inlined.txt +48 -48
- data/golden/shift_2d/expected/lir_03_cse.txt +48 -48
- data/golden/shift_2d/expected/lir_04_1_loop_fusion.txt +48 -48
- data/golden/shift_2d/expected/lir_04_loop_invcm.txt +48 -48
- data/golden/shift_2d/expected/lir_06_const_prop.txt +48 -48
- data/golden/shift_2d/expected/schema_ruby.rb +1 -1
- data/golden/simple_math/expected/schema_ruby.rb +1 -1
- data/golden/streaming_basics/expected/schema_ruby.rb +1 -1
- data/golden/tuples/expected/lir_00_unoptimized.txt +4 -4
- data/golden/tuples/expected/lir_01_hoist_scalar_references.txt +4 -4
- data/golden/tuples/expected/lir_02_inlined.txt +4 -4
- data/golden/tuples/expected/lir_03_cse.txt +4 -4
- data/golden/tuples/expected/lir_04_1_loop_fusion.txt +4 -4
- data/golden/tuples/expected/lir_04_loop_invcm.txt +4 -4
- data/golden/tuples/expected/lir_06_const_prop.txt +4 -4
- data/golden/tuples/expected/schema_ruby.rb +1 -1
- data/golden/tuples_and_arrays/expected/lir_00_unoptimized.txt +1 -1
- data/golden/tuples_and_arrays/expected/lir_01_hoist_scalar_references.txt +1 -1
- data/golden/tuples_and_arrays/expected/lir_02_inlined.txt +2 -2
- data/golden/tuples_and_arrays/expected/lir_03_cse.txt +2 -2
- data/golden/tuples_and_arrays/expected/lir_04_1_loop_fusion.txt +2 -2
- data/golden/tuples_and_arrays/expected/lir_04_loop_invcm.txt +2 -2
- data/golden/tuples_and_arrays/expected/lir_06_const_prop.txt +2 -2
- data/golden/tuples_and_arrays/expected/schema_ruby.rb +1 -1
- data/golden/us_tax_2024/expected/ast.txt +865 -0
- data/golden/us_tax_2024/expected/input_plan.txt +61 -0
- data/golden/us_tax_2024/expected/lir_00_unoptimized.txt +901 -0
- data/golden/us_tax_2024/expected/lir_01_hoist_scalar_references.txt +901 -0
- data/golden/us_tax_2024/expected/lir_02_inlined.txt +5178 -0
- data/golden/us_tax_2024/expected/lir_03_cse.txt +2499 -0
- data/golden/us_tax_2024/expected/lir_04_1_loop_fusion.txt +2519 -0
- data/golden/us_tax_2024/expected/lir_04_loop_invcm.txt +2439 -0
- data/golden/us_tax_2024/expected/lir_06_const_prop.txt +2439 -0
- data/golden/us_tax_2024/expected/nast.txt +976 -0
- data/golden/us_tax_2024/expected/schema_javascript.mjs +584 -0
- data/golden/us_tax_2024/expected/schema_ruby.rb +639 -0
- data/golden/us_tax_2024/expected/snast.txt +976 -0
- data/golden/us_tax_2024/expected.json +1 -0
- data/golden/us_tax_2024/input.json +168 -0
- data/golden/us_tax_2024/schema.kumi +203 -0
- data/golden/with_constants/expected/schema_ruby.rb +1 -1
- data/lib/kumi/core/analyzer/passes/lir/inline_declarations_pass.rb +181 -105
- data/lib/kumi/core/analyzer/passes/output_schema_pass.rb +6 -4
- data/lib/kumi/core/functions/function_spec.rb +14 -8
- data/lib/kumi/core/functions/loader.rb +1 -1
- data/lib/kumi/version.rb +1 -1
- metadata +33 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c54cad2db678a526d6441efd2b8c84ed68b023573a4eea0bdee49abb038932bf
|
4
|
+
data.tar.gz: 9ad65c4c21e99d780ac228f171d875bf42d08600254a1f336c2f903955b4b94e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 486203f6da8806d00d372053f1484398350b2e9b07d19fb682ebe97e913479abf7e3481d014c0d455f2c86722cd837a924939d2a65a38655712a5eec588d0ec9
|
7
|
+
data.tar.gz: 80d7653af56665416a660e75fe9687003b9575bfe0bb087e02e8fd38ee0597cdfaf6ae16558275ded11ef0e3d5ad2bc2d3fd7c451b32b5740fe8030a2b561c13
|
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,11 @@
|
|
1
1
|
## [Unreleased]
|
2
|
+
## [0.0.24] – 2025-10-16
|
3
|
+
### Fixed
|
4
|
+
- Bug when inlining of declarations with multiple axis reductions.
|
5
|
+
|
6
|
+
## [0.0.23] – 2025-10-13
|
7
|
+
### Fixed
|
8
|
+
- OutputSchemaPass now excludes inline `:let` declarations from output_schema metadata, matching JS/Ruby codegen behavior
|
2
9
|
|
3
10
|
## [0.0.22] – 2025-10-13
|
4
11
|
### Removed
|
data/README.md
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
[](https://github.com/amuta/kumi/actions)
|
4
4
|
[](https://badge.fury.io/rb/kumi)
|
5
5
|
|
6
|
+
**[Try the interactive demo →](https://kumi-play-web.fly.dev/)**
|
6
7
|
|
7
8
|
---
|
8
9
|
|
@@ -13,23 +14,15 @@
|
|
13
14
|
---
|
14
15
|
|
15
16
|
|
16
|
-
|
17
|
+
**Declarative calculation DSL for Ruby.** Write business rules once, run them anywhere.
|
17
18
|
|
18
|
-
-
|
19
|
-
- Performs **static validation** at definition time.
|
20
|
-
- Lowers to a **portable Low-level IR (LIR)**.
|
21
|
-
- Code-generates standalone **Ruby** and **JavaScript**.
|
19
|
+
Kumi compiles high-level schemas into standalone Ruby and JavaScript with no runtime dependencies.
|
22
20
|
|
23
|
-
|
21
|
+
**Built for:** finance, tax, pricing, insurance, payroll, analytics—domains where correctness and transparency matter.
|
24
22
|
|
25
23
|
---
|
26
24
|
|
27
|
-
##
|
28
|
-
|
29
|
-
*Note: this is not available on the last published gem version (0.0.18), but if you clone this repository you can just copy a ./golden/$schema_name and modify schema.kumi as you and run bin/kumi golden test $schema_name*
|
30
|
-
|
31
|
-
|
32
|
-
Kumi emits the kernel for your schema with no runtime in the target language. You can use it within your ruby application backend and/or export to the client.
|
25
|
+
## Example: Conway's Game of Life
|
33
26
|
|
34
27
|
|
35
28
|
<details>
|
@@ -78,114 +71,39 @@ end
|
|
78
71
|
|
79
72
|
</details>
|
80
73
|
|
81
|
-
<details>
|
82
|
-
<summary><strong>Optimized LIR (lowered IR)</strong></summary>
|
83
|
-
|
84
|
-
```bash
|
85
|
-
# ...
|
86
|
-
(Declaration next_state
|
87
|
-
%t285 = load_input "rows" :: array
|
88
|
-
%t1539 = Length %t285 :: integer
|
89
|
-
%t1540 = const -1 :: integer
|
90
|
-
%t1542 = const 0 :: integer
|
91
|
-
%t1546 = const 1 :: integer
|
92
|
-
%t1334 = const 3 :: integer
|
93
|
-
%t1339 = const 2 :: integer
|
94
|
-
%t1547 = call core.sub(%t1539, %t1546) :: integer
|
95
|
-
loop rows id=L31 in %t285 as el=%rows_el_286, idx=%rows_i_287
|
96
|
-
%t1541 = call core.sub(%rows_i_287, %t1540) :: integer
|
97
|
-
%t1561 = call core.sub(%rows_i_287, %t1546) :: integer
|
98
|
-
%t1580 = call core.mod(%rows_i_287, %t1539) :: integer
|
99
|
-
# ...
|
100
|
-
```
|
101
|
-
|
102
|
-
</details>
|
103
|
-
|
104
|
-
<details>
|
105
|
-
<summary><strong>Generated Ruby (excerpt)</strong></summary>
|
106
|
-
|
107
|
-
```ruby
|
108
|
-
# Autogenerated by Kumi Codegen
|
109
|
-
module Kumi::Compiled::KUMI_bd17a3ebee1bec4e58b72118d43e8c1c93bf773f257fc93d9c32a783d212ea4f
|
110
|
-
def self.from(input_data = nil)
|
111
|
-
instance = Object.new
|
112
|
-
instance.extend(self)
|
113
|
-
instance.instance_variable_set(:@input, input_data)
|
114
|
-
instance
|
115
|
-
end
|
116
|
-
|
117
|
-
def self.__kumi_executable__
|
118
|
-
instance = Object.new
|
119
|
-
instance.extend(self)
|
120
|
-
instance
|
121
|
-
end
|
122
|
-
|
123
|
-
def update(input_data)
|
124
|
-
@input = @input.merge(input_data)
|
125
|
-
self
|
126
|
-
end
|
127
|
-
|
128
|
-
def [](name)
|
129
|
-
case name
|
130
|
-
when :next_state then _next_state
|
131
|
-
else raise KeyError, "Unknown declaration"
|
132
|
-
end
|
133
|
-
end
|
134
|
-
|
135
|
-
def _next_state(input = @input)
|
136
|
-
out = []
|
137
|
-
t285 = input["rows"] || input[:rows]
|
138
|
-
t1539 = t285.length
|
139
|
-
t1540 = -1
|
140
|
-
t1542 = 0
|
141
|
-
t1546 = 1
|
142
|
-
t1334 = 3
|
143
|
-
t1339 = 2
|
144
|
-
t1547 = t1539 - t1546
|
145
|
-
t285.each_with_index do |rows_el_286, rows_i_287|
|
146
|
-
out_1 = []
|
147
|
-
t1541 = rows_i_287 - t1540
|
148
|
-
t1561 = rows_i_287 - t1546
|
149
|
-
t1580 = rows_i_287 % t1539
|
150
|
-
t1543 = t1541 >= t1542
|
151
|
-
t1544 = t1541 < t1539
|
152
|
-
t1549 = [[ t1541, t1542 ].max, t1547 ].min
|
153
|
-
t1563 = t1561 >= t1542
|
154
|
-
# ...
|
155
|
-
```
|
156
|
-
|
157
|
-
</details>
|
158
74
|
|
159
75
|
<details>
|
160
76
|
<summary><strong>Generated JavaScript (excerpt)</strong></summary>
|
161
77
|
|
162
78
|
```js
|
163
|
-
export
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
79
|
+
export function _next_state(input) {
|
80
|
+
let out = [];
|
81
|
+
let t285 = input["rows"];
|
82
|
+
let t1539 = t285.length;
|
83
|
+
const t1540 = -1;
|
84
|
+
const t1542 = 0;
|
85
|
+
const t1546 = 1;
|
86
|
+
const t1334 = 3;
|
87
|
+
const t1339 = 2;
|
88
|
+
let t1547 = t1539 - t1546;
|
89
|
+
t285.forEach((rows_el_286, rows_i_287) => {
|
90
|
+
let out_1 = [];
|
91
|
+
let t1541 = rows_i_287 - t1540;
|
92
|
+
let t1561 = rows_i_287 - t1546;
|
93
|
+
let t1580 = ((rows_i_287 % t1539) + t1539) % t1539;
|
94
|
+
// ... neighbor calculations, Conway's rules
|
95
|
+
let t1332 = [t1557, t1577, t1597, t1617, t1645, t1673, t1701, t1729];
|
96
|
+
let t1333 = t1332.reduce((a, b) => a + b, 0);
|
97
|
+
let t1335 = t1333 == t1334;
|
98
|
+
let t1340 = t1333 == t1339;
|
99
|
+
let t1344 = col_el_288 > t1542;
|
100
|
+
let t1345 = t1340 && t1344;
|
101
|
+
let t528 = t1335 || t1345;
|
102
|
+
let t293 = t528 ? t1546 : t1542;
|
103
|
+
out_1.push(t293);
|
104
|
+
});
|
105
|
+
return out;
|
106
|
+
}
|
189
107
|
```
|
190
108
|
|
191
109
|
</details>
|
@@ -200,8 +118,34 @@ gem install kumi
|
|
200
118
|
|
201
119
|
Requires Ruby 3.1+. No external dependencies.
|
202
120
|
|
121
|
+
## Quick Start
|
122
|
+
|
123
|
+
```ruby
|
124
|
+
require 'kumi'
|
125
|
+
|
126
|
+
Kumi.configure do |config|
|
127
|
+
config.compilation_mode = :jit
|
128
|
+
end
|
129
|
+
|
130
|
+
module Double
|
131
|
+
extend Kumi::Schema
|
132
|
+
|
133
|
+
schema do
|
134
|
+
input { integer :x }
|
135
|
+
value :doubled, input.x * 2
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
# Execute in Ruby
|
140
|
+
result = Double.from(x: 5)
|
141
|
+
result[:doubled] # => 10
|
142
|
+
|
143
|
+
# Export to JavaScript
|
144
|
+
Double.write_source("output.mjs", platform: :javascript)
|
145
|
+
```
|
146
|
+
|
203
147
|
---
|
204
148
|
|
205
149
|
## License
|
206
150
|
|
207
|
-
MIT License. See [LICENSE](LICENSE).
|
151
|
+
MIT License. See [LICENSE](LICENSE).
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# Autogenerated by Kumi Codegen
|
2
|
-
module Kumi::Compiled::
|
2
|
+
module Kumi::Compiled::KUMI_1c8ed5675ebbb47c48988ebc1e7a688bdfe46a08c8c7fa3343ae03cb81feb8d2
|
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::
|
2
|
+
module Kumi::Compiled::KUMI_045c4888923226ccaa83f46e8cbb54fb076042110dd637c5df35f0717b18886d
|
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::
|
2
|
+
module Kumi::Compiled::KUMI_ad5e88ef777b7ff03fc054fb2532e158fd95f50237e7a7431485f2433e7b8998
|
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::
|
2
|
+
module Kumi::Compiled::KUMI_c60fd677ad0c8a7b4023f22e28bd9ff4c05455c34a57687b7e6d186c59eb360c
|
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::
|
2
|
+
module Kumi::Compiled::KUMI_b02df7846ba29e94c8a665ca8d8aa1e248aea9154904c851bc619ecc87526657
|
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::
|
2
|
+
module Kumi::Compiled::KUMI_cd218374a442352129564ba66fdc114d3f395c40c049f8f0253da3c7bd20c5ef
|
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::
|
2
|
+
module Kumi::Compiled::KUMI_f5ff83c5472452825724e8d6146d84050de84e9c1f3ece855cde1d1599126d71
|
3
3
|
def self.from(input_data = nil)
|
4
4
|
instance = Object.new
|
5
5
|
instance.extend(self)
|
@@ -11,7 +11,7 @@
|
|
11
11
|
%t6 = load_input "rows" :: array
|
12
12
|
loop rows id=L3 in %t6 as el=%rows_el_7, idx=%rows_i_8
|
13
13
|
loop col id=L4 in %rows_el_7 as el=%col_el_9, idx=%col_i_10
|
14
|
-
%t11 =
|
14
|
+
%t11 = length %t6 :: integer
|
15
15
|
%t12 = const -1 :: integer
|
16
16
|
%t13 = call core.sub(%rows_i_8, %t12) :: integer
|
17
17
|
%t14 = const 0 :: integer
|
@@ -22,12 +22,12 @@
|
|
22
22
|
%t19 = call core.sub(%t11, %t18) :: integer
|
23
23
|
%t20 = const 0 :: integer
|
24
24
|
%t21 = call core.clamp(%t13, %t20, %t19) :: integer
|
25
|
-
%t22 =
|
26
|
-
%t23 =
|
25
|
+
%t22 = gather %t6, %t21 :: any
|
26
|
+
%t23 = length %t22 :: integer
|
27
27
|
%t24 = call core.mod(%col_i_10, %t23) :: integer
|
28
28
|
%t25 = call core.add(%t24, %t23) :: integer
|
29
29
|
%t26 = call core.mod(%t25, %t23) :: integer
|
30
|
-
%t27 =
|
30
|
+
%t27 = gather %t22, %t26 :: integer
|
31
31
|
%t28 = const 0 :: integer
|
32
32
|
%t29 = select %t17, %t27, %t28 :: integer
|
33
33
|
yield %t29
|
@@ -38,7 +38,7 @@
|
|
38
38
|
%t30 = load_input "rows" :: array
|
39
39
|
loop rows id=L5 in %t30 as el=%rows_el_31, idx=%rows_i_32
|
40
40
|
loop col id=L6 in %rows_el_31 as el=%col_el_33, idx=%col_i_34
|
41
|
-
%t35 =
|
41
|
+
%t35 = length %t30 :: integer
|
42
42
|
%t36 = const 1 :: integer
|
43
43
|
%t37 = call core.sub(%rows_i_32, %t36) :: integer
|
44
44
|
%t38 = const 0 :: integer
|
@@ -49,12 +49,12 @@
|
|
49
49
|
%t43 = call core.sub(%t35, %t42) :: integer
|
50
50
|
%t44 = const 0 :: integer
|
51
51
|
%t45 = call core.clamp(%t37, %t44, %t43) :: integer
|
52
|
-
%t46 =
|
53
|
-
%t47 =
|
52
|
+
%t46 = gather %t30, %t45 :: any
|
53
|
+
%t47 = length %t46 :: integer
|
54
54
|
%t48 = call core.mod(%col_i_34, %t47) :: integer
|
55
55
|
%t49 = call core.add(%t48, %t47) :: integer
|
56
56
|
%t50 = call core.mod(%t49, %t47) :: integer
|
57
|
-
%t51 =
|
57
|
+
%t51 = gather %t46, %t50 :: integer
|
58
58
|
%t52 = const 0 :: integer
|
59
59
|
%t53 = select %t41, %t51, %t52 :: integer
|
60
60
|
yield %t53
|
@@ -65,12 +65,12 @@
|
|
65
65
|
%t54 = load_input "rows" :: array
|
66
66
|
loop rows id=L7 in %t54 as el=%rows_el_55, idx=%rows_i_56
|
67
67
|
loop col id=L8 in %rows_el_55 as el=%col_el_57, idx=%col_i_58
|
68
|
-
%t59 =
|
68
|
+
%t59 = length %t54 :: integer
|
69
69
|
%t60 = call core.mod(%rows_i_56, %t59) :: integer
|
70
70
|
%t61 = call core.add(%t60, %t59) :: integer
|
71
71
|
%t62 = call core.mod(%t61, %t59) :: integer
|
72
|
-
%t63 =
|
73
|
-
%t64 =
|
72
|
+
%t63 = gather %t54, %t62 :: any
|
73
|
+
%t64 = length %t63 :: integer
|
74
74
|
%t65 = const -1 :: integer
|
75
75
|
%t66 = call core.sub(%col_i_58, %t65) :: integer
|
76
76
|
%t67 = const 0 :: integer
|
@@ -81,7 +81,7 @@
|
|
81
81
|
%t72 = call core.sub(%t64, %t71) :: integer
|
82
82
|
%t73 = const 0 :: integer
|
83
83
|
%t74 = call core.clamp(%t66, %t73, %t72) :: integer
|
84
|
-
%t75 =
|
84
|
+
%t75 = gather %t63, %t74 :: integer
|
85
85
|
%t76 = const 0 :: integer
|
86
86
|
%t77 = select %t70, %t75, %t76 :: integer
|
87
87
|
yield %t77
|
@@ -92,12 +92,12 @@
|
|
92
92
|
%t78 = load_input "rows" :: array
|
93
93
|
loop rows id=L9 in %t78 as el=%rows_el_79, idx=%rows_i_80
|
94
94
|
loop col id=L10 in %rows_el_79 as el=%col_el_81, idx=%col_i_82
|
95
|
-
%t83 =
|
95
|
+
%t83 = length %t78 :: integer
|
96
96
|
%t84 = call core.mod(%rows_i_80, %t83) :: integer
|
97
97
|
%t85 = call core.add(%t84, %t83) :: integer
|
98
98
|
%t86 = call core.mod(%t85, %t83) :: integer
|
99
|
-
%t87 =
|
100
|
-
%t88 =
|
99
|
+
%t87 = gather %t78, %t86 :: any
|
100
|
+
%t88 = length %t87 :: integer
|
101
101
|
%t89 = const 1 :: integer
|
102
102
|
%t90 = call core.sub(%col_i_82, %t89) :: integer
|
103
103
|
%t91 = const 0 :: integer
|
@@ -108,7 +108,7 @@
|
|
108
108
|
%t96 = call core.sub(%t88, %t95) :: integer
|
109
109
|
%t97 = const 0 :: integer
|
110
110
|
%t98 = call core.clamp(%t90, %t97, %t96) :: integer
|
111
|
-
%t99 =
|
111
|
+
%t99 = gather %t87, %t98 :: integer
|
112
112
|
%t100 = const 0 :: integer
|
113
113
|
%t101 = select %t94, %t99, %t100 :: integer
|
114
114
|
yield %t101
|
@@ -119,7 +119,7 @@
|
|
119
119
|
%t102 = load_input "rows" :: array
|
120
120
|
loop rows id=L11 in %t102 as el=%rows_el_103, idx=%rows_i_104
|
121
121
|
loop col id=L12 in %rows_el_103 as el=%col_el_105, idx=%col_i_106
|
122
|
-
%t107 =
|
122
|
+
%t107 = length %t102 :: integer
|
123
123
|
%t108 = const -1 :: integer
|
124
124
|
%t109 = call core.sub(%rows_i_104, %t108) :: integer
|
125
125
|
%t110 = const 0 :: integer
|
@@ -130,8 +130,8 @@
|
|
130
130
|
%t115 = call core.sub(%t107, %t114) :: integer
|
131
131
|
%t116 = const 0 :: integer
|
132
132
|
%t117 = call core.clamp(%t109, %t116, %t115) :: integer
|
133
|
-
%t118 =
|
134
|
-
%t119 =
|
133
|
+
%t118 = gather %t102, %t117 :: any
|
134
|
+
%t119 = length %t118 :: integer
|
135
135
|
%t120 = const -1 :: integer
|
136
136
|
%t121 = call core.sub(%col_i_106, %t120) :: integer
|
137
137
|
%t122 = const 0 :: integer
|
@@ -143,7 +143,7 @@
|
|
143
143
|
%t128 = call core.sub(%t119, %t127) :: integer
|
144
144
|
%t129 = const 0 :: integer
|
145
145
|
%t130 = call core.clamp(%t121, %t129, %t128) :: integer
|
146
|
-
%t131 =
|
146
|
+
%t131 = gather %t118, %t130 :: integer
|
147
147
|
%t132 = const 0 :: integer
|
148
148
|
%t133 = select %t126, %t131, %t132 :: integer
|
149
149
|
yield %t133
|
@@ -154,7 +154,7 @@
|
|
154
154
|
%t134 = load_input "rows" :: array
|
155
155
|
loop rows id=L13 in %t134 as el=%rows_el_135, idx=%rows_i_136
|
156
156
|
loop col id=L14 in %rows_el_135 as el=%col_el_137, idx=%col_i_138
|
157
|
-
%t139 =
|
157
|
+
%t139 = length %t134 :: integer
|
158
158
|
%t140 = const -1 :: integer
|
159
159
|
%t141 = call core.sub(%rows_i_136, %t140) :: integer
|
160
160
|
%t142 = const 0 :: integer
|
@@ -165,8 +165,8 @@
|
|
165
165
|
%t147 = call core.sub(%t139, %t146) :: integer
|
166
166
|
%t148 = const 0 :: integer
|
167
167
|
%t149 = call core.clamp(%t141, %t148, %t147) :: integer
|
168
|
-
%t150 =
|
169
|
-
%t151 =
|
168
|
+
%t150 = gather %t134, %t149 :: any
|
169
|
+
%t151 = length %t150 :: integer
|
170
170
|
%t152 = const 1 :: integer
|
171
171
|
%t153 = call core.sub(%col_i_138, %t152) :: integer
|
172
172
|
%t154 = const 0 :: integer
|
@@ -178,7 +178,7 @@
|
|
178
178
|
%t160 = call core.sub(%t151, %t159) :: integer
|
179
179
|
%t161 = const 0 :: integer
|
180
180
|
%t162 = call core.clamp(%t153, %t161, %t160) :: integer
|
181
|
-
%t163 =
|
181
|
+
%t163 = gather %t150, %t162 :: integer
|
182
182
|
%t164 = const 0 :: integer
|
183
183
|
%t165 = select %t158, %t163, %t164 :: integer
|
184
184
|
yield %t165
|
@@ -189,7 +189,7 @@
|
|
189
189
|
%t166 = load_input "rows" :: array
|
190
190
|
loop rows id=L15 in %t166 as el=%rows_el_167, idx=%rows_i_168
|
191
191
|
loop col id=L16 in %rows_el_167 as el=%col_el_169, idx=%col_i_170
|
192
|
-
%t171 =
|
192
|
+
%t171 = length %t166 :: integer
|
193
193
|
%t172 = const 1 :: integer
|
194
194
|
%t173 = call core.sub(%rows_i_168, %t172) :: integer
|
195
195
|
%t174 = const 0 :: integer
|
@@ -200,8 +200,8 @@
|
|
200
200
|
%t179 = call core.sub(%t171, %t178) :: integer
|
201
201
|
%t180 = const 0 :: integer
|
202
202
|
%t181 = call core.clamp(%t173, %t180, %t179) :: integer
|
203
|
-
%t182 =
|
204
|
-
%t183 =
|
203
|
+
%t182 = gather %t166, %t181 :: any
|
204
|
+
%t183 = length %t182 :: integer
|
205
205
|
%t184 = const -1 :: integer
|
206
206
|
%t185 = call core.sub(%col_i_170, %t184) :: integer
|
207
207
|
%t186 = const 0 :: integer
|
@@ -213,7 +213,7 @@
|
|
213
213
|
%t192 = call core.sub(%t183, %t191) :: integer
|
214
214
|
%t193 = const 0 :: integer
|
215
215
|
%t194 = call core.clamp(%t185, %t193, %t192) :: integer
|
216
|
-
%t195 =
|
216
|
+
%t195 = gather %t182, %t194 :: integer
|
217
217
|
%t196 = const 0 :: integer
|
218
218
|
%t197 = select %t190, %t195, %t196 :: integer
|
219
219
|
yield %t197
|
@@ -224,7 +224,7 @@
|
|
224
224
|
%t198 = load_input "rows" :: array
|
225
225
|
loop rows id=L17 in %t198 as el=%rows_el_199, idx=%rows_i_200
|
226
226
|
loop col id=L18 in %rows_el_199 as el=%col_el_201, idx=%col_i_202
|
227
|
-
%t203 =
|
227
|
+
%t203 = length %t198 :: integer
|
228
228
|
%t204 = const 1 :: integer
|
229
229
|
%t205 = call core.sub(%rows_i_200, %t204) :: integer
|
230
230
|
%t206 = const 0 :: integer
|
@@ -235,8 +235,8 @@
|
|
235
235
|
%t211 = call core.sub(%t203, %t210) :: integer
|
236
236
|
%t212 = const 0 :: integer
|
237
237
|
%t213 = call core.clamp(%t205, %t212, %t211) :: integer
|
238
|
-
%t214 =
|
239
|
-
%t215 =
|
238
|
+
%t214 = gather %t198, %t213 :: any
|
239
|
+
%t215 = length %t214 :: integer
|
240
240
|
%t216 = const 1 :: integer
|
241
241
|
%t217 = call core.sub(%col_i_202, %t216) :: integer
|
242
242
|
%t218 = const 0 :: integer
|
@@ -248,7 +248,7 @@
|
|
248
248
|
%t224 = call core.sub(%t215, %t223) :: integer
|
249
249
|
%t225 = const 0 :: integer
|
250
250
|
%t226 = call core.clamp(%t217, %t225, %t224) :: integer
|
251
|
-
%t227 =
|
251
|
+
%t227 = gather %t214, %t226 :: integer
|
252
252
|
%t228 = const 0 :: integer
|
253
253
|
%t229 = select %t222, %t227, %t228 :: integer
|
254
254
|
yield %t229
|
@@ -268,7 +268,7 @@
|
|
268
268
|
%t241 = load_decl sw axes=[rows, col] :: integer
|
269
269
|
%t242 = load_decl se axes=[rows, col] :: integer
|
270
270
|
%t243 = make_tuple(%t235, %t236, %t237, %t238, %t239, %t240, %t241, %t242) :: tuple<integer>
|
271
|
-
%t244 =
|
271
|
+
%t244 = fold %t243 fn="agg.sum" ::
|
272
272
|
yield %t244
|
273
273
|
end_loop
|
274
274
|
end_loop
|