Class: Kumi::IR::Loop::Ops::ShiftRead

Inherits:
Node show all
Defined in:
lib/kumi/ir/loop/ops/core_ops.rb

Constant Summary collapse

POLICIES =
%i[wrap clamp].freeze

Instance Attribute Summary

Attributes inherited from Base::Instruction

#attributes, #axes, #dtype, #effects, #inputs, #metadata, #opcode, #result

Instance Method Summary collapse

Methods inherited from Node

opcode, #to_h

Methods inherited from Base::Instruction

#control_effect?, #defs, #effectful?, #io_effect?, #memory_effect?, #normalized_attributes, #printer_attributes, #printer_axes, #printer_dtype, #produces?, #stamp, #state_effect?, #to_h, #to_print_string, #uses, #validate!, #value_signature, #with_metadata

Constructor Details

#initialize(array:, index:, length:, offset:, policy:, **kwargs) ⇒ ShiftRead

Returns a new instance of ShiftRead.

Raises:

  • (ArgumentError)


130
131
132
133
134
135
136
137
138
139
# File 'lib/kumi/ir/loop/ops/core_ops.rb', line 130

def initialize(array:, index:, length:, offset:, policy:, **kwargs)
  policy = policy.to_sym
  raise ArgumentError, "invalid shift policy #{policy}" unless POLICIES.include?(policy)

  super(
    inputs: [array, index, length],
    attributes: { offset: Integer(offset), policy: policy },
    **kwargs
  )
end

Instance Method Details

#offsetObject



141
# File 'lib/kumi/ir/loop/ops/core_ops.rb', line 141

def offset = attributes[:offset]

#policyObject



142
# File 'lib/kumi/ir/loop/ops/core_ops.rb', line 142

def policy = attributes[:policy]