carray-jit 0.1.3 → 0.1.4
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 +146 -0
- data/README.md +11 -10
- data/carray-jit.gemspec +1 -1
- data/docs/00_Introduction.md +2 -1
- data/docs/02_KernelShapes.md +1 -1
- data/docs/03_SupportedFeatures.md +88 -11
- data/docs/04_Compiling.md +2 -2
- data/docs/05_DesignNotes.md +1 -1
- data/docs/06_Cheatsheet.md +3 -3
- data/docs/07_StepByStep.ja.md +14 -15
- data/docs/07_StepByStep.md +14 -15
- data/docs/08_LanguageReference.md +427 -0
- data/lib/carray/jit/analyzer.rb +144 -7
- data/lib/carray/jit/c_function.rb +359 -21
- data/lib/carray/jit/c_generator.rb +398 -58
- data/lib/carray/jit/compiler.rb +27 -3
- data/lib/carray/jit/expression.rb +271 -33
- data/lib/carray/jit/kernel.rb +17 -4
- data/lib/carray/jit/node.rb +15 -0
- data/lib/carray/jit/type_assignment.rb +53 -1
- data/lib/carray/jit/version.rb +1 -1
- data/lib/carray/jit.rb +7 -33
- metadata +4 -3
data/lib/carray/jit.rb
CHANGED
|
@@ -37,9 +37,9 @@ class CArray
|
|
|
37
37
|
# no extent, and is written with CArray.jit_each or CArray.jit_map instead.
|
|
38
38
|
#
|
|
39
39
|
# Arrays and scalars are the variables the block closes over, so nothing has
|
|
40
|
-
# to be named twice. Which way each axis runs is
|
|
41
|
-
#
|
|
42
|
-
#
|
|
40
|
+
# to be named twice. Which way each axis runs is the extent's: a Range runs
|
|
41
|
+
# up, a step of -1 runs down, and the kernel runs the order it is given
|
|
42
|
+
# without checking it against the cells the body reads.
|
|
43
43
|
#
|
|
44
44
|
# A block outside the compilable subset raises CArray::JIT::Unsupported
|
|
45
45
|
# rather than falling back to a Ruby loop. Nobody calls this method except
|
|
@@ -1837,31 +1837,13 @@ class CArray
|
|
|
1837
1837
|
case value
|
|
1838
1838
|
when CArray then arrays[name] = value
|
|
1839
1839
|
when CFunction then c_functions[name] = value
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
randoms[name] = refuse_an_unpasteable(name, value)
|
|
1843
|
-
else
|
|
1844
|
-
scalars[name] = value
|
|
1845
|
-
end
|
|
1840
|
+
when CArray::Rng then randoms[name] = refuse_an_unpasteable(name, value)
|
|
1841
|
+
else scalars[name] = value
|
|
1846
1842
|
end
|
|
1847
1843
|
end
|
|
1848
1844
|
[arrays, scalars, c_functions, randoms]
|
|
1849
1845
|
end
|
|
1850
1846
|
|
|
1851
|
-
# `CArray::Rng`, or nil where the CArray in use has none.
|
|
1852
|
-
#
|
|
1853
|
-
# Asked of the object rather than of the version, because the version
|
|
1854
|
-
# cannot answer: 3.0.2 is where the class arrived and 3.0.2 is also
|
|
1855
|
-
# what the release before it called itself. Asked once and remembered,
|
|
1856
|
-
# and reached only after a capture has failed to be an array or a
|
|
1857
|
-
# function -- a bare `when CArray::Rng` is evaluated for every captured
|
|
1858
|
-
# number, and against a CArray without the class that is a NameError
|
|
1859
|
-
# loose in a kernel that never mentions a generator.
|
|
1860
|
-
def generator_class
|
|
1861
|
-
return @generator_class unless @generator_class.nil?
|
|
1862
|
-
@generator_class = defined?(CArray::Rng) ? CArray::Rng : false
|
|
1863
|
-
end
|
|
1864
|
-
|
|
1865
1847
|
# A generator CArray can run but cannot hand the source of.
|
|
1866
1848
|
#
|
|
1867
1849
|
# Checked here rather than where a generator is made, because a
|
|
@@ -2071,13 +2053,5 @@ end
|
|
|
2071
2053
|
# installed, and the same answer without it.
|
|
2072
2054
|
# ---------------------------------------------------------------------------
|
|
2073
2055
|
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
# somewhere to register. Without them the Prism front end above is the
|
|
2077
|
-
# whole of this gem, exactly as before.
|
|
2078
|
-
if CArray.respond_to?(:expression_evaluator) &&
|
|
2079
|
-
CArray.respond_to?(:__kernel_body__) &&
|
|
2080
|
-
CArray.const_defined?(:BUILD_FLAGS)
|
|
2081
|
-
require "carray/jit/expression"
|
|
2082
|
-
CArray.expression_evaluator = CArray::JIT::Expression.new
|
|
2083
|
-
end
|
|
2056
|
+
require "carray/jit/expression"
|
|
2057
|
+
CArray.expression_evaluator = CArray::JIT::Expression.new
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: carray-jit
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- himotoyoshi
|
|
@@ -15,7 +15,7 @@ dependencies:
|
|
|
15
15
|
requirements:
|
|
16
16
|
- - ">="
|
|
17
17
|
- !ruby/object:Gem::Version
|
|
18
|
-
version: 3.0.
|
|
18
|
+
version: 3.0.3
|
|
19
19
|
- - "<"
|
|
20
20
|
- !ruby/object:Gem::Version
|
|
21
21
|
version: '3.1'
|
|
@@ -25,7 +25,7 @@ dependencies:
|
|
|
25
25
|
requirements:
|
|
26
26
|
- - ">="
|
|
27
27
|
- !ruby/object:Gem::Version
|
|
28
|
-
version: 3.0.
|
|
28
|
+
version: 3.0.3
|
|
29
29
|
- - "<"
|
|
30
30
|
- !ruby/object:Gem::Version
|
|
31
31
|
version: '3.1'
|
|
@@ -71,6 +71,7 @@ files:
|
|
|
71
71
|
- docs/06_Cheatsheet.md
|
|
72
72
|
- docs/07_StepByStep.ja.md
|
|
73
73
|
- docs/07_StepByStep.md
|
|
74
|
+
- docs/08_LanguageReference.md
|
|
74
75
|
- examples/README.md
|
|
75
76
|
- examples/applications/alarm.rb
|
|
76
77
|
- examples/applications/collatz.rb
|