Module: Kumi::Core::IR::Ops
- Defined in:
- lib/kumi/core/ir.rb
Class Method Summary collapse
-
.AlignTo(target_slot, source_slot, to_scope:, on_missing: :error, require_unique: true) ⇒ Object
Up-sample ‘source` to the scope (and order) of `target` by index-prefix.
- .Array(count, *slots) ⇒ Object
- .Assign(dst:, src:) ⇒ Object
- .Const(v) ⇒ Object
- .GuardPop ⇒ Object
- .GuardPush(cond_slot) ⇒ Object
- .Join(*slots) ⇒ Object
- .Lift(to_scope, slot) ⇒ Object
- .LoadInput(plan_id, scope: [], is_scalar: false, has_idx: false) ⇒ Object
- .Map(fn, argc, *slots) ⇒ Object
- .Reduce(fn, axis, result_scope, flatten, slot) ⇒ Object
- .Ref(name) ⇒ Object
- .Store(name, slot) ⇒ Object
- .Switch(cases, default) ⇒ Object
Class Method Details
.AlignTo(target_slot, source_slot, to_scope:, on_missing: :error, require_unique: true) ⇒ Object
Up-sample ‘source` to the scope (and order) of `target` by index-prefix. Policies: :error | :nil for missing; require_unique: true enforces 1:1 on prefix.
48 49 50 51 52 53 54 55 |
# File 'lib/kumi/core/ir.rb', line 48 def self.AlignTo(target_slot, source_slot, to_scope:, on_missing: :error, require_unique: true) scope_array = to_scope.is_a?(::Array) ? to_scope : [to_scope] IR::Op.new( tag: :align_to, attrs: { to_scope: scope_array, on_missing: on_missing, require_unique: require_unique }, args: [target_slot, source_slot] ) end |
.Array(count, *slots) ⇒ Object
37 |
# File 'lib/kumi/core/ir.rb', line 37 def self.Array(count, *slots) = IR::Op.new(tag: :array, attrs: { count: count }, args: slots) |
.Assign(dst:, src:) ⇒ Object
41 |
# File 'lib/kumi/core/ir.rb', line 41 def self.Assign(dst:, src:) = IR::Op.new(tag: :assign, attrs: { dst: dst, src: src }, args: []) |
.Const(v) ⇒ Object
29 |
# File 'lib/kumi/core/ir.rb', line 29 def self.Const(v) = IR::Op.new(tag: :const, attrs: { value: v }, args: []) |
.GuardPop ⇒ Object
40 |
# File 'lib/kumi/core/ir.rb', line 40 def self.GuardPop = IR::Op.new(tag: :guard_pop, attrs: {}, args: []) |
.GuardPush(cond_slot) ⇒ Object
39 |
# File 'lib/kumi/core/ir.rb', line 39 def self.GuardPush(cond_slot) = IR::Op.new(tag: :guard_push, attrs: { cond_slot: cond_slot }, args: []) |
.Join(*slots) ⇒ Object
44 |
# File 'lib/kumi/core/ir.rb', line 44 def self.Join(*slots) = IR::Op.new(tag: :join, attrs: {}, args: slots) |
.Lift(to_scope, slot) ⇒ Object
43 |
# File 'lib/kumi/core/ir.rb', line 43 def self.Lift(to_scope, slot) = IR::Op.new(tag: :lift, attrs: { to_scope: to_scope }, args: [slot]) |
.LoadInput(plan_id, scope: [], is_scalar: false, has_idx: false) ⇒ Object
31 32 33 |
# File 'lib/kumi/core/ir.rb', line 31 def self.LoadInput(plan_id, scope: [], is_scalar: false, has_idx: false) = IR::Op.new(tag: :load_input, attrs: { plan_id: plan_id, scope: scope, is_scalar: is_scalar, has_idx: has_idx }, args: []) |
.Map(fn, argc, *slots) ⇒ Object
36 |
# File 'lib/kumi/core/ir.rb', line 36 def self.Map(fn, argc, *slots) = IR::Op.new(tag: :map, attrs: { fn: fn, argc: argc }, args: slots) |
.Reduce(fn, axis, result_scope, flatten, slot) ⇒ Object
57 58 59 |
# File 'lib/kumi/core/ir.rb', line 57 def self.Reduce(fn, axis, result_scope, flatten, slot) IR::Op.new(tag: :reduce, attrs: { fn: fn, axis: axis, result_scope: result_scope, flatten: flatten }, args: [slot]) end |
.Ref(name) ⇒ Object
35 |
# File 'lib/kumi/core/ir.rb', line 35 def self.Ref(name) = IR::Op.new(tag: :ref, attrs: { name: name }, args: []) |
.Store(name, slot) ⇒ Object
42 |
# File 'lib/kumi/core/ir.rb', line 42 def self.Store(name, slot) = IR::Op.new(tag: :store, attrs: { name: name }, args: [slot]) |
.Switch(cases, default) ⇒ Object
38 |
# File 'lib/kumi/core/ir.rb', line 38 def self.Switch(cases, default) = IR::Op.new(tag: :switch, attrs: { cases: cases, default: default }, args: []) |