Class: Ikra::Symbolic::ArrayInHostSectionCommand
- Includes:
- ArrayCommand
- Defined in:
- lib/symbolic/host_section.rb,
lib/symbolic/visitor.rb
Overview
An array that that is referenced using C++/CUDA expressions. Such an array does not necessarily have to be present in the Ruby interpreter. Its size does also not have to be known at compile time.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#base_type ⇒ Object
Returns the value of attribute base_type.
-
#target ⇒ Object
Returns the value of attribute target.
Attributes included from ArrayCommand
#block, #block_size, #generator_node, #gpu_result_pointer, #input, #keep, #unique_id
Instance Method Summary collapse
- #==(other) ⇒ Object
- #accept(visitor) ⇒ Object
-
#dimensions ⇒ Object
TODO: Support multiple dimensions.
-
#initialize(target, base_type, block_size: DEFAULT_BLOCK_SIZE) ⇒ ArrayInHostSectionCommand
constructor
A new instance of ArrayInHostSectionCommand.
- #size ⇒ Object
Methods included from ArrayCommand
#[], #block_def_node, #block_parameter_names, #command_binding, #command_translator_class, #each, #eql?, #execute, #externals, #has_previous_result?, #hash, #ikra_type, included, #lexical_externals, #pack, #post_execute, reset_unique_id, #result_type, #set_unique_id, #to_c_type, #to_command, #to_ffi_type, #to_ruby_type, #to_s, #with_index
Methods included from Types::RubyType
#class_id, #eql?, #hash, #inspect, #is_primitive?, #is_union_type?, #should_generate_self_arg?, #to_array_type, #to_c_type, #to_ruby_type, #to_str, #to_union_type
Methods included from ParallelOperations
#&, #*, #+, #-, #/, #<, #<=, #>, #>=, #^, #pcombine, #pmap, #preduce, #pstencil, #pzip, #|
Constructor Details
#initialize(target, base_type, block_size: DEFAULT_BLOCK_SIZE) ⇒ ArrayInHostSectionCommand
Returns a new instance of ArrayInHostSectionCommand.
62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/symbolic/host_section.rb', line 62 def initialize(target, base_type, block_size: DEFAULT_BLOCK_SIZE) super(block_size: block_size) if base_type == nil raise AssertionError.new("base_type missing") end # One thread per array element @input = [SingleInput.new(command: target, pattern: :tid)] @base_type = base_type end |
Instance Attribute Details
#base_type ⇒ Object
Returns the value of attribute base_type.
60 61 62 |
# File 'lib/symbolic/host_section.rb', line 60 def base_type @base_type end |
#target ⇒ Object
Returns the value of attribute target.
59 60 61 |
# File 'lib/symbolic/host_section.rb', line 59 def target @target end |
Instance Method Details
#==(other) ⇒ Object
84 85 86 |
# File 'lib/symbolic/host_section.rb', line 84 def ==(other) return super(other) && base_type == other.base_type end |
#accept(visitor) ⇒ Object
52 53 54 |
# File 'lib/symbolic/visitor.rb', line 52 def accept(visitor) visitor.visit_array_in_host_section_command(self) end |
#dimensions ⇒ Object
TODO: Support multiple dimensions
80 81 82 |
# File 'lib/symbolic/host_section.rb', line 80 def dimensions return [size] end |
#size ⇒ Object
74 75 76 77 |
# File 'lib/symbolic/host_section.rb', line 74 def size # Size is not known at compile time. Return a source code string here. return "#{input.first.command}->size()" end |