Class: Ikra::Symbolic::Input

Inherits:
Object
  • Object
show all
Defined in:
lib/symbolic/input.rb,
lib/symbolic/input_visitor.rb,
lib/translator/input_translator.rb,
lib/types/inference/input_inference.rb

Overview

Specifies an input parameter for a parallel section. A parameter might be expanded to multiple parameters in the generated CUDA code to avoid passing arrays etc.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(pattern:) ⇒ Input

Returns a new instance of Input.



12
13
14
15
# File 'lib/symbolic/input.rb', line 12

def initialize(pattern:)
    # Currently supported: :tid, :entire
    @pattern = pattern
end

Instance Attribute Details

#commandObject (readonly)

Returns the value of attribute command.



10
11
12
# File 'lib/symbolic/input.rb', line 10

def command
  @command
end

#patternObject (readonly)

Returns the access pattern of this input, e.g., ‘:tid` (single element, identified by thread ID) or `:entire` (access to entire array is necessary).



8
9
10
# File 'lib/symbolic/input.rb', line 8

def pattern
  @pattern
end

Instance Method Details

#==(other) ⇒ Object



17
18
19
20
21
# File 'lib/symbolic/input.rb', line 17

def ==(other)
    return self.class == other.class &&
        self.pattern == other.pattern &&
        self.command == other.command
end

#accept(visitor) ⇒ Object



7
8
9
# File 'lib/symbolic/input_visitor.rb', line 7

def accept(visitor)
    visitor.visit_input(self, pattern: pattern)
end

#eql?(other) ⇒ Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/symbolic/input.rb', line 27

def eql?(other)
    return self == other
end

#get_parameters(**kwargs) ⇒ Object

Raises:

  • (NotImplementedError)


4
5
6
# File 'lib/types/inference/input_inference.rb', line 4

def get_parameters(**kwargs)
    raise NotImplementedError.new
end

#hashObject



23
24
25
# File 'lib/symbolic/input.rb', line 23

def hash
    return (pattern.hash + command.hash) % 7656781
end

#translate_input(**kwargs) ⇒ Object

Raises:

  • (NotImplementedError)


4
5
6
# File 'lib/translator/input_translator.rb', line 4

def translate_input(**kwargs)
    raise NotImplementedError.new
end