tiramisu-ml 0.1.1__tar.gz

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.
Files changed (170) hide show
  1. tiramisu_ml-0.1.1/.clang-format +280 -0
  2. tiramisu_ml-0.1.1/.gitattributes +1 -0
  3. tiramisu_ml-0.1.1/.github/workflows/cmake-multi-platform.yml +101 -0
  4. tiramisu_ml-0.1.1/.github/workflows/pages-wasm.yml +99 -0
  5. tiramisu_ml-0.1.1/.github/workflows/publish.yml +66 -0
  6. tiramisu_ml-0.1.1/.gitignore +28 -0
  7. tiramisu_ml-0.1.1/CMakeLists.txt +94 -0
  8. tiramisu_ml-0.1.1/LICENSE +7 -0
  9. tiramisu_ml-0.1.1/PKG-INFO +115 -0
  10. tiramisu_ml-0.1.1/README.md +103 -0
  11. tiramisu_ml-0.1.1/autograd/CMakeLists.txt +11 -0
  12. tiramisu_ml-0.1.1/autograd/README.md +4 -0
  13. tiramisu_ml-0.1.1/autograd/include/tiramisu/autograd/grad_mode.hpp +18 -0
  14. tiramisu_ml-0.1.1/autograd/include/tiramisu/autograd/gradcheck.hpp +12 -0
  15. tiramisu_ml-0.1.1/autograd/include/tiramisu/autograd/ops.hpp +34 -0
  16. tiramisu_ml-0.1.1/autograd/src/grad_mode.cpp +15 -0
  17. tiramisu_ml-0.1.1/autograd/src/gradcheck.cpp +44 -0
  18. tiramisu_ml-0.1.1/autograd/src/ops.cpp +836 -0
  19. tiramisu_ml-0.1.1/bench/README.md +4 -0
  20. tiramisu_ml-0.1.1/checkpoints/mnist_mlp.bin +0 -0
  21. tiramisu_ml-0.1.1/checkpoints/shakespeare_2m.ckpt +3 -0
  22. tiramisu_ml-0.1.1/core/CMakeLists.txt +25 -0
  23. tiramisu_ml-0.1.1/core/include/tiramisu/core/cuda_common.hpp +27 -0
  24. tiramisu_ml-0.1.1/core/include/tiramisu/core/cuda_memory.hpp +22 -0
  25. tiramisu_ml-0.1.1/core/include/tiramisu/core/device.hpp +7 -0
  26. tiramisu_ml-0.1.1/core/include/tiramisu/core/dtype.hpp +24 -0
  27. tiramisu_ml-0.1.1/core/include/tiramisu/core/node.hpp +16 -0
  28. tiramisu_ml-0.1.1/core/include/tiramisu/core/storage.hpp +35 -0
  29. tiramisu_ml-0.1.1/core/include/tiramisu/core/tensor.hpp +88 -0
  30. tiramisu_ml-0.1.1/core/include/tiramisu/core/version.hpp +12 -0
  31. tiramisu_ml-0.1.1/core/src/cuda_common.cpp +44 -0
  32. tiramisu_ml-0.1.1/core/src/cuda_memory.cpp +143 -0
  33. tiramisu_ml-0.1.1/core/src/cuda_memory.cu +82 -0
  34. tiramisu_ml-0.1.1/core/src/dtype.cpp +16 -0
  35. tiramisu_ml-0.1.1/core/src/storage.cpp +84 -0
  36. tiramisu_ml-0.1.1/core/src/tensor.cpp +288 -0
  37. tiramisu_ml-0.1.1/core/src/version.cpp +7 -0
  38. tiramisu_ml-0.1.1/docs/assets/mnist_training.gif +0 -0
  39. tiramisu_ml-0.1.1/examples/CMakeLists.txt +48 -0
  40. tiramisu_ml-0.1.1/examples/generate_wasm.cpp +289 -0
  41. tiramisu_ml-0.1.1/examples/hello_tiramisu.cpp +8 -0
  42. tiramisu_ml-0.1.1/examples/mnist.cpp +224 -0
  43. tiramisu_ml-0.1.1/examples/mnist_infer_wasm.cpp +119 -0
  44. tiramisu_ml-0.1.1/examples/python/gpt_step.py +39 -0
  45. tiramisu_ml-0.1.1/examples/python/linear_forward.py +16 -0
  46. tiramisu_ml-0.1.1/examples/shakespeare_vocab.inc +2 -0
  47. tiramisu_ml-0.1.1/examples/train_shakespeare.cpp +626 -0
  48. tiramisu_ml-0.1.1/nn/CMakeLists.txt +19 -0
  49. tiramisu_ml-0.1.1/nn/README.md +3 -0
  50. tiramisu_ml-0.1.1/nn/include/tiramisu/nn/embedding.hpp +23 -0
  51. tiramisu_ml-0.1.1/nn/include/tiramisu/nn/feed_forward.hpp +20 -0
  52. tiramisu_ml-0.1.1/nn/include/tiramisu/nn/gpt.hpp +50 -0
  53. tiramisu_ml-0.1.1/nn/include/tiramisu/nn/kv_cache.hpp +29 -0
  54. tiramisu_ml-0.1.1/nn/include/tiramisu/nn/layernorm.hpp +21 -0
  55. tiramisu_ml-0.1.1/nn/include/tiramisu/nn/linear.hpp +24 -0
  56. tiramisu_ml-0.1.1/nn/include/tiramisu/nn/loss.hpp +10 -0
  57. tiramisu_ml-0.1.1/nn/include/tiramisu/nn/module.hpp +18 -0
  58. tiramisu_ml-0.1.1/nn/include/tiramisu/nn/multi_head_attention.hpp +37 -0
  59. tiramisu_ml-0.1.1/nn/include/tiramisu/nn/parameter.hpp +12 -0
  60. tiramisu_ml-0.1.1/nn/include/tiramisu/nn/sequential.hpp +19 -0
  61. tiramisu_ml-0.1.1/nn/include/tiramisu/nn/transformer_block.hpp +28 -0
  62. tiramisu_ml-0.1.1/nn/src/embedding.cpp +16 -0
  63. tiramisu_ml-0.1.1/nn/src/feed_forward.cpp +22 -0
  64. tiramisu_ml-0.1.1/nn/src/gpt.cpp +185 -0
  65. tiramisu_ml-0.1.1/nn/src/kv_cache.cpp +91 -0
  66. tiramisu_ml-0.1.1/nn/src/layernorm.cpp +29 -0
  67. tiramisu_ml-0.1.1/nn/src/linear.cpp +18 -0
  68. tiramisu_ml-0.1.1/nn/src/loss.cpp +122 -0
  69. tiramisu_ml-0.1.1/nn/src/module.cpp +9 -0
  70. tiramisu_ml-0.1.1/nn/src/multi_head_attention.cpp +172 -0
  71. tiramisu_ml-0.1.1/nn/src/parameter.cpp +49 -0
  72. tiramisu_ml-0.1.1/nn/src/sequential.cpp +25 -0
  73. tiramisu_ml-0.1.1/nn/src/transformer_block.cpp +58 -0
  74. tiramisu_ml-0.1.1/ops/CMakeLists.txt +38 -0
  75. tiramisu_ml-0.1.1/ops/cpu/README.md +0 -0
  76. tiramisu_ml-0.1.1/ops/cpu/broadcast.cpp +32 -0
  77. tiramisu_ml-0.1.1/ops/cpu/elementwise.cpp +177 -0
  78. tiramisu_ml-0.1.1/ops/cpu/embedding.cpp +51 -0
  79. tiramisu_ml-0.1.1/ops/cpu/matmul.cpp +222 -0
  80. tiramisu_ml-0.1.1/ops/cpu/normalization.cpp +126 -0
  81. tiramisu_ml-0.1.1/ops/cpu/reduce.cpp +49 -0
  82. tiramisu_ml-0.1.1/ops/cuda/README.md +10 -0
  83. tiramisu_ml-0.1.1/ops/cuda/backward.cu +481 -0
  84. tiramisu_ml-0.1.1/ops/cuda/ops.cu +499 -0
  85. tiramisu_ml-0.1.1/ops/include/tiramisu/ops/broadcast.hpp +13 -0
  86. tiramisu_ml-0.1.1/ops/include/tiramisu/ops/cuda_ops.hpp +48 -0
  87. tiramisu_ml-0.1.1/ops/include/tiramisu/ops/elementwise.hpp +19 -0
  88. tiramisu_ml-0.1.1/ops/include/tiramisu/ops/embedding.hpp +9 -0
  89. tiramisu_ml-0.1.1/ops/include/tiramisu/ops/matmul.hpp +10 -0
  90. tiramisu_ml-0.1.1/ops/include/tiramisu/ops/normalization.hpp +11 -0
  91. tiramisu_ml-0.1.1/ops/include/tiramisu/ops/reduce.hpp +11 -0
  92. tiramisu_ml-0.1.1/optim/CMakeLists.txt +13 -0
  93. tiramisu_ml-0.1.1/optim/README.md +3 -0
  94. tiramisu_ml-0.1.1/optim/include/tiramisu/optim/adam.hpp +24 -0
  95. tiramisu_ml-0.1.1/optim/include/tiramisu/optim/adamw.hpp +34 -0
  96. tiramisu_ml-0.1.1/optim/include/tiramisu/optim/grad_clip.hpp +11 -0
  97. tiramisu_ml-0.1.1/optim/include/tiramisu/optim/lr_scheduler.hpp +22 -0
  98. tiramisu_ml-0.1.1/optim/include/tiramisu/optim/sgd.hpp +19 -0
  99. tiramisu_ml-0.1.1/optim/src/adam.cpp +83 -0
  100. tiramisu_ml-0.1.1/optim/src/adamw.cpp +100 -0
  101. tiramisu_ml-0.1.1/optim/src/grad_clip.cpp +47 -0
  102. tiramisu_ml-0.1.1/optim/src/lr_scheduler.cpp +39 -0
  103. tiramisu_ml-0.1.1/optim/src/sgd.cpp +29 -0
  104. tiramisu_ml-0.1.1/pyproject.toml +45 -0
  105. tiramisu_ml-0.1.1/python/CMakeLists.txt +24 -0
  106. tiramisu_ml-0.1.1/python/README.md +95 -0
  107. tiramisu_ml-0.1.1/python/bindings.cpp +260 -0
  108. tiramisu_ml-0.1.1/python/tiramisu/__init__.py +45 -0
  109. tiramisu_ml-0.1.1/python/tiramisu/nn.py +10 -0
  110. tiramisu_ml-0.1.1/python/tiramisu/optim.py +7 -0
  111. tiramisu_ml-0.1.1/quant/README.md +3 -0
  112. tiramisu_ml-0.1.1/scripts/export_shakespeare_vocab.py +52 -0
  113. tiramisu_ml-0.1.1/scripts/parse_shakespeare_log.py +94 -0
  114. tiramisu_ml-0.1.1/scripts/plot_training.py +132 -0
  115. tiramisu_ml-0.1.1/scripts/requirements.txt +1 -0
  116. tiramisu_ml-0.1.1/scripts/run_10m_training.sh +21 -0
  117. tiramisu_ml-0.1.1/scripts/train_and_export_mnist.sh +40 -0
  118. tiramisu_ml-0.1.1/serialize/CMakeLists.txt +10 -0
  119. tiramisu_ml-0.1.1/serialize/README.md +3 -0
  120. tiramisu_ml-0.1.1/serialize/include/tiramisu/serialize/checkpoint.hpp +37 -0
  121. tiramisu_ml-0.1.1/serialize/include/tiramisu/serialize/mnist_checkpoint.hpp +32 -0
  122. tiramisu_ml-0.1.1/serialize/src/checkpoint.cpp +299 -0
  123. tiramisu_ml-0.1.1/serialize/src/mnist_checkpoint.cpp +152 -0
  124. tiramisu_ml-0.1.1/tests/CMakeLists.txt +52 -0
  125. tiramisu_ml-0.1.1/tests/autograd/grad_mode_test.cpp +41 -0
  126. tiramisu_ml-0.1.1/tests/autograd/gradcheck_test.cpp +319 -0
  127. tiramisu_ml-0.1.1/tests/autograd/graph_test.cpp +21 -0
  128. tiramisu_ml-0.1.1/tests/autograd/integration_test.cpp +96 -0
  129. tiramisu_ml-0.1.1/tests/core/storage_test.cpp +77 -0
  130. tiramisu_ml-0.1.1/tests/core/tensor_autograd_test.cpp +41 -0
  131. tiramisu_ml-0.1.1/tests/core/tensor_slice_test.cpp +31 -0
  132. tiramisu_ml-0.1.1/tests/core/tensor_test.cpp +163 -0
  133. tiramisu_ml-0.1.1/tests/core/version_test.cpp +13 -0
  134. tiramisu_ml-0.1.1/tests/nn/embedding_test.cpp +54 -0
  135. tiramisu_ml-0.1.1/tests/nn/feed_forward_test.cpp +30 -0
  136. tiramisu_ml-0.1.1/tests/nn/gpt_test.cpp +117 -0
  137. tiramisu_ml-0.1.1/tests/nn/kv_cache_test.cpp +147 -0
  138. tiramisu_ml-0.1.1/tests/nn/layernorm_test.cpp +35 -0
  139. tiramisu_ml-0.1.1/tests/nn/linear_test.cpp +21 -0
  140. tiramisu_ml-0.1.1/tests/nn/loss_test.cpp +28 -0
  141. tiramisu_ml-0.1.1/tests/nn/multi_head_attention_test.cpp +56 -0
  142. tiramisu_ml-0.1.1/tests/nn/sequential_test.cpp +26 -0
  143. tiramisu_ml-0.1.1/tests/nn/transformer_block_test.cpp +50 -0
  144. tiramisu_ml-0.1.1/tests/ops/broadcast_test.cpp +30 -0
  145. tiramisu_ml-0.1.1/tests/ops/elementwise_test.cpp +131 -0
  146. tiramisu_ml-0.1.1/tests/ops/matmul_test.cpp +100 -0
  147. tiramisu_ml-0.1.1/tests/ops/normalization_test.cpp +44 -0
  148. tiramisu_ml-0.1.1/tests/ops/reduce_test.cpp +18 -0
  149. tiramisu_ml-0.1.1/tests/optim/adam_test.cpp +72 -0
  150. tiramisu_ml-0.1.1/tests/optim/adamw_test.cpp +37 -0
  151. tiramisu_ml-0.1.1/tests/optim/grad_clip_test.cpp +35 -0
  152. tiramisu_ml-0.1.1/tests/optim/lr_scheduler_test.cpp +21 -0
  153. tiramisu_ml-0.1.1/tests/optim/sgd_test.cpp +44 -0
  154. tiramisu_ml-0.1.1/tests/python/test_gpt.py +32 -0
  155. tiramisu_ml-0.1.1/tests/python/test_linear.py +13 -0
  156. tiramisu_ml-0.1.1/tests/python/test_tensor.py +51 -0
  157. tiramisu_ml-0.1.1/tests/serialize/checkpoint_test.cpp +43 -0
  158. tiramisu_ml-0.1.1/tests/serialize/mnist_checkpoint_test.cpp +129 -0
  159. tiramisu_ml-0.1.1/web/.dockerignore +8 -0
  160. tiramisu_ml-0.1.1/web/Dockerfile +39 -0
  161. tiramisu_ml-0.1.1/web/requirements.txt +3 -0
  162. tiramisu_ml-0.1.1/web/server.py +161 -0
  163. tiramisu_ml-0.1.1/web/static/index.html +52 -0
  164. tiramisu_ml-0.1.1/web/static/mnist/index.html +126 -0
  165. tiramisu_ml-0.1.1/web/static/mnist/mnist.js +206 -0
  166. tiramisu_ml-0.1.1/web/static/mnist/mnist_worker.js +96 -0
  167. tiramisu_ml-0.1.1/web/static/shakespeare/index.html +94 -0
  168. tiramisu_ml-0.1.1/web/static/shakespeare/infer_worker.js +114 -0
  169. tiramisu_ml-0.1.1/web/static/shakespeare/main.js +220 -0
  170. tiramisu_ml-0.1.1/web/static/style.css +645 -0
@@ -0,0 +1,280 @@
1
+ ---
2
+ Language: Cpp
3
+ # BasedOnStyle: Google
4
+ AccessModifierOffset: -1
5
+ AlignAfterOpenBracket: Align
6
+ AlignArrayOfStructures: None
7
+ AlignConsecutiveAssignments:
8
+ Enabled: false
9
+ AcrossEmptyLines: false
10
+ AcrossComments: false
11
+ AlignCompound: false
12
+ AlignFunctionPointers: false
13
+ PadOperators: true
14
+ AlignConsecutiveBitFields:
15
+ Enabled: false
16
+ AcrossEmptyLines: false
17
+ AcrossComments: false
18
+ AlignCompound: false
19
+ AlignFunctionPointers: false
20
+ PadOperators: false
21
+ AlignConsecutiveDeclarations:
22
+ Enabled: false
23
+ AcrossEmptyLines: false
24
+ AcrossComments: false
25
+ AlignCompound: false
26
+ AlignFunctionPointers: false
27
+ PadOperators: false
28
+ AlignConsecutiveMacros:
29
+ Enabled: false
30
+ AcrossEmptyLines: false
31
+ AcrossComments: false
32
+ AlignCompound: false
33
+ AlignFunctionPointers: false
34
+ PadOperators: false
35
+ AlignConsecutiveShortCaseStatements:
36
+ Enabled: false
37
+ AcrossEmptyLines: false
38
+ AcrossComments: false
39
+ AlignCaseColons: false
40
+ AlignEscapedNewlines: Left
41
+ AlignOperands: Align
42
+ AlignTrailingComments:
43
+ Kind: Always
44
+ OverEmptyLines: 0
45
+ AllowAllArgumentsOnNextLine: true
46
+ AllowAllParametersOfDeclarationOnNextLine: true
47
+ AllowBreakBeforeNoexceptSpecifier: Never
48
+ AllowShortBlocksOnASingleLine: Never
49
+ AllowShortCaseLabelsOnASingleLine: false
50
+ AllowShortCompoundRequirementOnASingleLine: true
51
+ AllowShortEnumsOnASingleLine: true
52
+ AllowShortFunctionsOnASingleLine: All
53
+ AllowShortIfStatementsOnASingleLine: WithoutElse
54
+ AllowShortLambdasOnASingleLine: All
55
+ AllowShortLoopsOnASingleLine: true
56
+ AlwaysBreakAfterDefinitionReturnType: None
57
+ AlwaysBreakAfterReturnType: None
58
+ AlwaysBreakBeforeMultilineStrings: true
59
+ AlwaysBreakTemplateDeclarations: Yes
60
+ AttributeMacros:
61
+ - __capability
62
+ BinPackArguments: true
63
+ BinPackParameters: true
64
+ BitFieldColonSpacing: Both
65
+ BraceWrapping:
66
+ AfterCaseLabel: false
67
+ AfterClass: false
68
+ AfterControlStatement: Never
69
+ AfterEnum: false
70
+ AfterExternBlock: false
71
+ AfterFunction: false
72
+ AfterNamespace: false
73
+ AfterObjCDeclaration: false
74
+ AfterStruct: false
75
+ AfterUnion: false
76
+ BeforeCatch: false
77
+ BeforeElse: false
78
+ BeforeLambdaBody: false
79
+ BeforeWhile: false
80
+ IndentBraces: false
81
+ SplitEmptyFunction: true
82
+ SplitEmptyRecord: true
83
+ SplitEmptyNamespace: true
84
+ BreakAdjacentStringLiterals: true
85
+ BreakAfterAttributes: Leave
86
+ BreakAfterJavaFieldAnnotations: false
87
+ BreakArrays: true
88
+ BreakBeforeBinaryOperators: None
89
+ BreakBeforeConceptDeclarations: Always
90
+ BreakBeforeBraces: Attach
91
+ BreakBeforeInlineASMColon: OnlyMultiline
92
+ BreakBeforeTernaryOperators: true
93
+ BreakConstructorInitializers: BeforeColon
94
+ BreakInheritanceList: BeforeColon
95
+ BreakStringLiterals: true
96
+ ColumnLimit: 80
97
+ CommentPragmas: '^ IWYU pragma:'
98
+ CompactNamespaces: false
99
+ ConstructorInitializerIndentWidth: 4
100
+ ContinuationIndentWidth: 4
101
+ Cpp11BracedListStyle: true
102
+ DerivePointerAlignment: true
103
+ DisableFormat: false
104
+ EmptyLineAfterAccessModifier: Never
105
+ EmptyLineBeforeAccessModifier: LogicalBlock
106
+ ExperimentalAutoDetectBinPacking: false
107
+ FixNamespaceComments: true
108
+ ForEachMacros:
109
+ - foreach
110
+ - Q_FOREACH
111
+ - BOOST_FOREACH
112
+ IfMacros:
113
+ - KJ_IF_MAYBE
114
+ IncludeBlocks: Regroup
115
+ IncludeCategories:
116
+ - Regex: '^<ext/.*\.h>'
117
+ Priority: 2
118
+ SortPriority: 0
119
+ CaseSensitive: false
120
+ - Regex: '^<.*\.h>'
121
+ Priority: 1
122
+ SortPriority: 0
123
+ CaseSensitive: false
124
+ - Regex: '^<.*'
125
+ Priority: 2
126
+ SortPriority: 0
127
+ CaseSensitive: false
128
+ - Regex: '.*'
129
+ Priority: 3
130
+ SortPriority: 0
131
+ CaseSensitive: false
132
+ IncludeIsMainRegex: '([-_](test|unittest))?$'
133
+ IncludeIsMainSourceRegex: ''
134
+ IndentAccessModifiers: false
135
+ IndentCaseBlocks: false
136
+ IndentCaseLabels: true
137
+ IndentExternBlock: AfterExternBlock
138
+ IndentGotoLabels: true
139
+ IndentPPDirectives: None
140
+ IndentRequiresClause: true
141
+ IndentWidth: 2
142
+ IndentWrappedFunctionNames: false
143
+ InsertBraces: false
144
+ InsertNewlineAtEOF: false
145
+ InsertTrailingCommas: None
146
+ IntegerLiteralSeparator:
147
+ Binary: 0
148
+ BinaryMinDigits: 0
149
+ Decimal: 0
150
+ DecimalMinDigits: 0
151
+ Hex: 0
152
+ HexMinDigits: 0
153
+ JavaScriptQuotes: Leave
154
+ JavaScriptWrapImports: true
155
+ KeepEmptyLinesAtTheStartOfBlocks: false
156
+ KeepEmptyLinesAtEOF: false
157
+ LambdaBodyIndentation: Signature
158
+ LineEnding: DeriveLF
159
+ MacroBlockBegin: ''
160
+ MacroBlockEnd: ''
161
+ MaxEmptyLinesToKeep: 1
162
+ NamespaceIndentation: None
163
+ ObjCBinPackProtocolList: Never
164
+ ObjCBlockIndentWidth: 2
165
+ ObjCBreakBeforeNestedBlockParam: true
166
+ ObjCSpaceAfterProperty: false
167
+ ObjCSpaceBeforeProtocolList: true
168
+ PackConstructorInitializers: NextLine
169
+ PenaltyBreakAssignment: 2
170
+ PenaltyBreakBeforeFirstCallParameter: 1
171
+ PenaltyBreakComment: 300
172
+ PenaltyBreakFirstLessLess: 120
173
+ PenaltyBreakOpenParenthesis: 0
174
+ PenaltyBreakScopeResolution: 500
175
+ PenaltyBreakString: 1000
176
+ PenaltyBreakTemplateDeclaration: 10
177
+ PenaltyExcessCharacter: 1000000
178
+ PenaltyIndentedWhitespace: 0
179
+ PenaltyReturnTypeOnItsOwnLine: 200
180
+ PointerAlignment: Left
181
+ PPIndentWidth: -1
182
+ QualifierAlignment: Leave
183
+ RawStringFormats:
184
+ - Language: Cpp
185
+ Delimiters:
186
+ - cc
187
+ - CC
188
+ - cpp
189
+ - Cpp
190
+ - CPP
191
+ - 'c++'
192
+ - 'C++'
193
+ CanonicalDelimiter: ''
194
+ BasedOnStyle: google
195
+ - Language: TextProto
196
+ Delimiters:
197
+ - pb
198
+ - PB
199
+ - proto
200
+ - PROTO
201
+ EnclosingFunctions:
202
+ - EqualsProto
203
+ - EquivToProto
204
+ - PARSE_PARTIAL_TEXT_PROTO
205
+ - PARSE_TEST_PROTO
206
+ - PARSE_TEXT_PROTO
207
+ - ParseTextOrDie
208
+ - ParseTextProtoOrDie
209
+ - ParseTestProto
210
+ - ParsePartialTestProto
211
+ CanonicalDelimiter: pb
212
+ BasedOnStyle: google
213
+ ReferenceAlignment: Pointer
214
+ ReflowComments: true
215
+ RemoveBracesLLVM: false
216
+ RemoveParentheses: Leave
217
+ RemoveSemicolon: false
218
+ RequiresClausePosition: OwnLine
219
+ RequiresExpressionIndentation: OuterScope
220
+ SeparateDefinitionBlocks: Leave
221
+ ShortNamespaceLines: 1
222
+ SkipMacroDefinitionBody: false
223
+ SortIncludes: CaseSensitive
224
+ SortJavaStaticImport: Before
225
+ SortUsingDeclarations: LexicographicNumeric
226
+ SpaceAfterCStyleCast: false
227
+ SpaceAfterLogicalNot: false
228
+ SpaceAfterTemplateKeyword: true
229
+ SpaceAroundPointerQualifiers: Default
230
+ SpaceBeforeAssignmentOperators: true
231
+ SpaceBeforeCaseColon: false
232
+ SpaceBeforeCpp11BracedList: false
233
+ SpaceBeforeCtorInitializerColon: true
234
+ SpaceBeforeInheritanceColon: true
235
+ SpaceBeforeJsonColon: false
236
+ SpaceBeforeParens: ControlStatements
237
+ SpaceBeforeParensOptions:
238
+ AfterControlStatements: true
239
+ AfterForeachMacros: true
240
+ AfterFunctionDefinitionName: false
241
+ AfterFunctionDeclarationName: false
242
+ AfterIfMacros: true
243
+ AfterOverloadedOperator: false
244
+ AfterPlacementOperator: true
245
+ AfterRequiresInClause: false
246
+ AfterRequiresInExpression: false
247
+ BeforeNonEmptyParentheses: false
248
+ SpaceBeforeRangeBasedForLoopColon: true
249
+ SpaceBeforeSquareBrackets: false
250
+ SpaceInEmptyBlock: false
251
+ SpacesBeforeTrailingComments: 2
252
+ SpacesInAngles: Never
253
+ SpacesInContainerLiterals: true
254
+ SpacesInLineCommentPrefix:
255
+ Minimum: 1
256
+ Maximum: -1
257
+ SpacesInParens: Never
258
+ SpacesInParensOptions:
259
+ InCStyleCasts: false
260
+ InConditionalStatements: false
261
+ InEmptyParentheses: false
262
+ Other: false
263
+ SpacesInSquareBrackets: false
264
+ Standard: Auto
265
+ StatementAttributeLikeMacros:
266
+ - Q_EMIT
267
+ StatementMacros:
268
+ - Q_UNUSED
269
+ - QT_REQUIRE_VERSION
270
+ TabWidth: 8
271
+ UseTab: Never
272
+ VerilogBreakBetweenInstancePorts: true
273
+ WhitespaceSensitiveMacros:
274
+ - BOOST_PP_STRINGIZE
275
+ - CF_SWIFT_NAME
276
+ - NS_SWIFT_NAME
277
+ - PP_STRINGIZE
278
+ - STRINGIZE
279
+ ...
280
+
@@ -0,0 +1 @@
1
+ *.ckpt filter=lfs diff=lfs merge=lfs -text
@@ -0,0 +1,101 @@
1
+ # This starter workflow is for a CMake project running on multiple platforms. There is a different starter workflow if you just want a single platform.
2
+ # See: https://github.com/actions/starter-workflows/blob/main/ci/cmake-single-platform.yml
3
+ name: CMake on multiple platforms
4
+
5
+ on:
6
+ push:
7
+ branches: [ "main" ]
8
+ pull_request:
9
+ branches: [ "main" ]
10
+
11
+ jobs:
12
+ build-and-test:
13
+ runs-on: ubuntu-latest
14
+
15
+ strategy:
16
+ # Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. Consider changing this to true when your workflow is stable.
17
+ fail-fast: false
18
+
19
+ # Set up a matrix to run the following 3 configurations:
20
+ # 1. <Windows, Release, latest MSVC compiler toolchain on the default runner image, default generator>
21
+ # 2. <Linux, Release, latest GCC compiler toolchain on the default runner image, default generator>
22
+ # 3. <Linux, Release, latest Clang compiler toolchain on the default runner image, default generator>
23
+ #
24
+ # To add more build types (Release, Debug, RelWithDebInfo, etc.) customize the build_type list.
25
+ matrix:
26
+ # os: [ubuntu-latest, windows-latest]
27
+ build_type: [Debug, Release]
28
+ # c_compiler: [gcc, clang, cl]
29
+ # include:
30
+ # - os: windows-latest
31
+ # c_compiler: cl
32
+ # cpp_compiler: cl
33
+ # - os: ubuntu-latest
34
+ # c_compiler: gcc
35
+ # cpp_compiler: g++
36
+ # - os: ubuntu-latest
37
+ # c_compiler: clang
38
+ # cpp_compiler: clang++
39
+ # exclude:
40
+ # - os: windows-latest
41
+ # c_compiler: gcc
42
+ # - os: windows-latest
43
+ # c_compiler: clang
44
+ # - os: ubuntu-latest
45
+ # c_compiler: cl
46
+
47
+ steps:
48
+ - uses: actions/checkout@v4
49
+ - name: Install Ninja
50
+ run: sudo apt-get update -qq && sudo apt-get install -y -qq ninja-build
51
+
52
+ - name: Configure (${{ matrix.build_type }})
53
+ run: >
54
+ cmake -S . -B build -G Ninja
55
+ -DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
56
+
57
+ - name: Build
58
+ # Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
59
+ run: cmake --build build --parallel
60
+
61
+ - name: Test
62
+ working-directory: build
63
+ # Execute tests defined by the CMake configuration. Note that --build-config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
64
+ # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
65
+ run: ctest --output-on-failure
66
+
67
+ cuda-compile:
68
+ runs-on: ubuntu-latest
69
+ steps:
70
+ - uses: actions/checkout@v4
71
+ - name: Install Ninja
72
+ run: sudo apt-get update -qq && sudo apt-get install -y -qq ninja-build
73
+ - name: Install CUDA toolkit
74
+ uses: Jimver/cuda-toolkit@v0.2.35
75
+ with:
76
+ cuda: '12.6.0'
77
+ method: network
78
+ sub-packages: '["nvcc", "cudart-dev"]'
79
+ - name: Configure CUDA build
80
+ run: >
81
+ cmake -S . -B build-cuda -G Ninja
82
+ -DCMAKE_BUILD_TYPE=Release
83
+ -DTIRAMISU_ENABLE_CUDA=ON
84
+ - name: Build
85
+ run: cmake --build build-cuda --parallel
86
+ python-bindings:
87
+ runs-on: ubuntu-latest
88
+ steps:
89
+ - uses: actions/checkout@v4
90
+ - name: Install build deps
91
+ run: sudo apt-get update -qq && sudo apt-get install -y -qq ninja-build
92
+ - uses: actions/setup-python@v5
93
+ with:
94
+ python-version: "3.12"
95
+ - name: Install package and run pytest
96
+ run: |
97
+ python -m pip install -U pip pytest numpy build
98
+ pip install ".[dev]"
99
+ pytest tests/python -v
100
+ - name: Build wheel
101
+ run: python -m build
@@ -0,0 +1,99 @@
1
+ name: Deploy WASM demo to GitHub Pages
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ workflow_dispatch:
7
+
8
+ permissions:
9
+ contents: read
10
+ pages: write
11
+ id-token: write
12
+
13
+ # Do not cancel in-flight deploys; cancelling mid-flight can wedge Pages.
14
+ concurrency:
15
+ group: pages
16
+ cancel-in-progress: false
17
+
18
+ jobs:
19
+ deploy:
20
+ runs-on: ubuntu-latest
21
+ environment:
22
+ name: github-pages
23
+ url: ${{ steps.deployment.outputs.page_url }}
24
+ steps:
25
+ - uses: actions/checkout@v4
26
+ with:
27
+ lfs: true
28
+
29
+ - name: Setup Emscripten
30
+ uses: mymindstorm/setup-emsdk@v14
31
+ with:
32
+ version: 3.1.64
33
+
34
+ - name: Configure WASM build
35
+ run: |
36
+ emcmake cmake -S . -B build-wasm \
37
+ -G Ninja \
38
+ -DCMAKE_BUILD_TYPE=Release \
39
+ -DTIRAMISU_BUILD_WASM=ON \
40
+ -DTIRAMISU_BUILD_TESTS=OFF \
41
+ -DTIRAMISU_BUILD_EXAMPLES=ON \
42
+ -DTIRAMISU_BUILD_BENCH=OFF \
43
+ -DTIRAMISU_BUILD_PYTHON=OFF \
44
+ -DTIRAMISU_ENABLE_CUDA=OFF \
45
+ -DTIRAMISU_ENABLE_SANITIZERS=OFF
46
+
47
+ - name: Build WASM inference targets
48
+ run: cmake --build build-wasm --target tiramisu_infer mnist_infer
49
+
50
+ - name: Assemble static site
51
+ run: |
52
+ mkdir -p site/shakespeare site/mnist site/shakespeare/assets site/mnist/assets
53
+ cp web/static/index.html web/static/style.css site/
54
+ cp -r web/static/shakespeare/* site/shakespeare/
55
+ cp -r web/static/mnist/* site/mnist/
56
+ cp build-wasm/examples/tiramisu_infer.js build-wasm/examples/tiramisu_infer.wasm site/shakespeare/
57
+ cp build-wasm/examples/mnist_infer.js build-wasm/examples/mnist_infer.wasm site/mnist/
58
+ cp checkpoints/shakespeare_2m.ckpt site/shakespeare/assets/
59
+ cp checkpoints/mnist_mlp.bin site/mnist/assets/
60
+ touch site/.nojekyll
61
+ chmod -R a+rX site
62
+ test -s site/shakespeare/assets/shakespeare_2m.ckpt
63
+ test -s site/mnist/assets/mnist_mlp.bin
64
+ du -sh site site/shakespeare/assets site/mnist/assets
65
+
66
+ - uses: actions/configure-pages@v5
67
+
68
+ - uses: actions/upload-pages-artifact@v3
69
+ with:
70
+ path: site
71
+
72
+ # Pages deploy API is intermittently flaky (actions/deploy-pages#418).
73
+ - name: Deploy to GitHub Pages (attempt 1)
74
+ id: deployment
75
+ uses: actions/deploy-pages@v4
76
+ continue-on-error: true
77
+
78
+ - name: Deploy to GitHub Pages (attempt 2)
79
+ id: deployment2
80
+ if: steps.deployment.outcome == 'failure'
81
+ uses: actions/deploy-pages@v4
82
+ continue-on-error: true
83
+
84
+ - name: Deploy to GitHub Pages (attempt 3)
85
+ id: deployment3
86
+ if: steps.deployment2.outcome == 'failure'
87
+ uses: actions/deploy-pages@v4
88
+ continue-on-error: true
89
+
90
+ - name: Verify deployment succeeded
91
+ if: >-
92
+ steps.deployment.outcome != 'success' &&
93
+ steps.deployment2.outcome != 'success' &&
94
+ steps.deployment3.outcome != 'success'
95
+ run: |
96
+ echo "::error::GitHub Pages deploy failed after 3 attempts."
97
+ echo "If DNS was just configured, wait a few minutes and re-run this workflow."
98
+ echo "Custom domain should be set only in Settings → Pages (not via a CNAME file)."
99
+ exit 1
@@ -0,0 +1,66 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ push:
5
+ tags: ["v*"]
6
+ workflow_dispatch:
7
+ inputs:
8
+ publish:
9
+ description: "Publish to PyPI (false = build only, artifacts uploaded to run)"
10
+ type: boolean
11
+ default: false
12
+
13
+ jobs:
14
+ build_wheels:
15
+ name: wheels ${{ matrix.os }}
16
+ runs-on: ${{ matrix.os }}
17
+ strategy:
18
+ fail-fast: false
19
+ matrix:
20
+ os: [ubuntu-24.04, ubuntu-24.04-arm, macos-14]
21
+ steps:
22
+ - uses: actions/checkout@v4
23
+
24
+ - name: Build wheels
25
+ uses: pypa/cibuildwheel@v2.21.3
26
+
27
+ - uses: actions/upload-artifact@v4
28
+ with:
29
+ name: wheels-${{ matrix.os }}
30
+ path: ./wheelhouse/*.whl
31
+
32
+ build_sdist:
33
+ name: sdist
34
+ runs-on: ubuntu-24.04
35
+ steps:
36
+ - uses: actions/checkout@v4
37
+
38
+ - uses: actions/setup-python@v5
39
+ with:
40
+ python-version: "3.12"
41
+
42
+ - name: Build sdist
43
+ run: pipx run build --sdist
44
+
45
+ - uses: actions/upload-artifact@v4
46
+ with:
47
+ name: sdist
48
+ path: dist/*.tar.gz
49
+
50
+ publish:
51
+ name: Publish to PyPI
52
+ needs: [build_wheels, build_sdist]
53
+ runs-on: ubuntu-24.04
54
+ if: github.event_name == 'push' || inputs.publish
55
+ environment:
56
+ name: pypi
57
+ url: https://pypi.org/p/tiramisu-ml
58
+ permissions:
59
+ id-token: write
60
+ steps:
61
+ - uses: actions/download-artifact@v4
62
+ with:
63
+ path: dist
64
+ merge-multiple: true
65
+
66
+ - uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,28 @@
1
+ build
2
+ build-*/
3
+ .cache/
4
+ compile_commands.json
5
+ *.o
6
+ *.obj
7
+ *.a
8
+ *.so
9
+ .vscode/
10
+ .idea/
11
+ __pycache__/
12
+ *.egg-info/
13
+ .venv/
14
+ .venv-ci/
15
+ dist/
16
+ build-wasm/
17
+ site/
18
+ *.whl
19
+
20
+ # MNIST data files
21
+ *.idx3-ubyte
22
+ *.idx1-ubyte
23
+ examples/train-images-idx3-ubyte/
24
+ examples/train-labels-idx1-ubyte/
25
+
26
+ data/tiny_shakespeare.txt
27
+ data/shakespeare_2m_train.csv
28
+ data/shakespeare_2m_train.log
@@ -0,0 +1,94 @@
1
+ cmake_minimum_required(VERSION 3.20)
2
+ project(tiramisu LANGUAGES CXX)
3
+
4
+ set(CMAKE_CXX_STANDARD 20)
5
+ set(CMAKE_CXX_STANDARD_REQUIRED ON)
6
+ set(CMAKE_CXX_EXTENSIONS OFF)
7
+ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
8
+
9
+ if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
10
+ set(CMAKE_BUILD_TYPE Debug CACHE STRING "Build type" FORCE)
11
+ endif()
12
+
13
+ option(TIRAMISU_BUILD_TESTS "Build unit tests" ON)
14
+ option(TIRAMISU_BUILD_EXAMPLES "Build example programs" ON)
15
+ option(TIRAMISU_BUILD_BENCH "Build microbenchmarks" OFF)
16
+ option(TIRAMISU_BUILD_PYTHON "Build pybind11 Python extension" OFF)
17
+ option(TIRAMISU_ENABLE_SANITIZERS "Build with ASan/UBSan in Debug builds" ON)
18
+ option(TIRAMISU_ENABLE_CUDA "Build CUDA backend (requires CUDA toolkit)" OFF)
19
+ option(TIRAMISU_BUILD_WASM "Build WebAssembly inference target (requires Emscripten)" OFF)
20
+
21
+ if(TIRAMISU_BUILD_WASM)
22
+ set(TIRAMISU_BUILD_TESTS OFF CACHE BOOL "Build unit tests" FORCE)
23
+ set(TIRAMISU_BUILD_BENCH OFF CACHE BOOL "Build microbenchmarks" FORCE)
24
+ set(TIRAMISU_BUILD_PYTHON OFF CACHE BOOL "Build pybind11 Python extension" FORCE)
25
+ set(TIRAMISU_ENABLE_CUDA OFF CACHE BOOL "Build CUDA backend" FORCE)
26
+ set(TIRAMISU_ENABLE_SANITIZERS OFF CACHE BOOL "Build with sanitizers" FORCE)
27
+ endif()
28
+
29
+ if(TIRAMISU_ENABLE_CUDA)
30
+ # Required when mixing .cpp and .cu in one target; 75 = GTX 1660 / Turing.
31
+ if(NOT CMAKE_CUDA_ARCHITECTURES)
32
+ set(CMAKE_CUDA_ARCHITECTURES 75 CACHE STRING "CUDA compute capabilities")
33
+ endif()
34
+ endif()
35
+
36
+ if (TIRAMISU_BUILD_PYTHON)
37
+ set(CMAKE_POSITION_INDEPENDENT_CODE ON)
38
+ endif()
39
+
40
+ # Shared interface targets
41
+
42
+ add_library(tiramisu_warnings INTERFACE)
43
+ if(NOT MSVC)
44
+ target_compile_options(tiramisu_warnings INTERFACE
45
+ -Wall -Wextra -Wpedantic -Wshadow
46
+ )
47
+ endif()
48
+
49
+ add_library(tiramisu_sanitizers INTERFACE)
50
+ if (TIRAMISU_ENABLE_SANITIZERS AND CMAKE_BUILD_TYPE STREQUAL "Debug")
51
+ target_compile_options(tiramisu_sanitizers INTERFACE
52
+ -fsanitize=address,undefined -fno-omit-frame-pointer
53
+ )
54
+ target_link_options(tiramisu_sanitizers INTERFACE
55
+ -fsanitize=address,undefined
56
+ )
57
+ endif()
58
+
59
+ # Library modules
60
+
61
+ add_subdirectory(core)
62
+ add_subdirectory(autograd)
63
+ add_subdirectory(ops)
64
+ add_subdirectory(nn)
65
+ add_subdirectory(optim)
66
+ add_subdirectory(serialize)
67
+
68
+ # Tests, examples, and bench
69
+
70
+ if (TIRAMISU_BUILD_TESTS)
71
+ enable_testing()
72
+ include(FetchContent)
73
+ FetchContent_Declare(
74
+ googletest
75
+ GIT_REPOSITORY https://github.com/google/googletest.git
76
+ GIT_TAG v1.15.2
77
+ )
78
+
79
+ set(INSTALL_GTEST OFF CACHE BOOL "" FORCE)
80
+ FetchContent_MakeAvailable(googletest)
81
+ add_subdirectory(tests)
82
+ endif()
83
+
84
+ if (TIRAMISU_BUILD_EXAMPLES)
85
+ add_subdirectory(examples)
86
+ endif()
87
+
88
+ if (TIRAMISU_BUILD_BENCH)
89
+ add_subdirectory(bench)
90
+ endif()
91
+
92
+ if (TIRAMISU_BUILD_PYTHON)
93
+ add_subdirectory(python)
94
+ endif()
@@ -0,0 +1,7 @@
1
+ Copyright © 2026 nex
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.