-
Notifications
You must be signed in to change notification settings - Fork 47
Add 2D Autoencoder and GMM Integration on Siracusa Target #190
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: devel
Are you sure you want to change the base?
Changes from all commits
78b3219
69238a1
0886b0c
0bed995
73a208e
558cb87
7656503
7d26e67
5d952d2
42c0fc6
8e2a2aa
46f704e
79634fa
24ce4fc
15727d4
1eea246
291f5e1
779360d
e74788f
430b80f
1602838
b78b270
b542c00
d7edb4c
da40b15
5b3949d
b80be5a
488c52c
3aa5994
491ee95
e5b7f0d
61d14a3
aeb7d72
3f0c82c
76baf5b
1368123
ba191f9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -88,4 +88,4 @@ | |
| "default": "-v --doublebuffer" | ||
| } | ||
| ] | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -977,8 +977,6 @@ def hoistConstant(self, | |
| Returns the name of the newly registed ConstantBuffer | ||
|
|
||
| """ | ||
| assert len(constant.outputs) <= 1, f"Constant {constant.name} has more than one output" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Has this assert been removed just for a test to pass? :) |
||
|
|
||
| name = name if name is not None else constant.name | ||
|
|
||
| # LMACAN: The shape needs to be copied into a tuple for pickling to work. Don't ask me why.. | ||
|
|
@@ -2028,22 +2026,18 @@ def parse(self, ctxt: NetworkContext, default_channels_first: bool) -> Tuple[Net | |
|
|
||
| def _broadcastToNpType(self, ty: Type[BaseType]): | ||
|
|
||
| def _broadcastInteger(ty: Type[IntegerImmediate]): | ||
| if ty.signed: | ||
| return np.dtype(getattr(np, "int" + str(ty.typeWidth))) | ||
| else: | ||
| return np.dtype(getattr(np, "uint" + str(ty.typeWidth))) | ||
| def _broadcastInteger(immediateType: Type[IntegerImmediate]): | ||
| prefix = "int" if immediateType.signed else "uint" | ||
| return np.dtype(getattr(np, prefix + str(immediateType.typeWidth))) | ||
|
|
||
| def _broadcastFloat(ty: Type[FloatImmediate]): | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think that you just moved the entire content (with some modifications) from here into _deeployTypeToNpType that then gets called here. I don't see the reason for this, I think it's better to just apply the changes directly here, no need for a separate function |
||
| return np.dtype(getattr(np, "double")) | ||
| def _broadcastFloat(immediateType: Type[FloatImmediate]): | ||
| return np.dtype(getattr(np, "float" + str(immediateType.typeWidth))) | ||
|
|
||
| if issubclass(ty, Pointer) and hasattr(ty, "referencedType"): | ||
| if issubclass(ty.referencedType, IntegerImmediate): | ||
| return _broadcastInteger(ty.referencedType) | ||
| elif issubclass(ty, IntegerImmediate): | ||
| return _broadcastInteger(ty) | ||
| elif issubclass(ty, FloatImmediate): | ||
| return _broadcastFloat(ty) | ||
| immediateType = ty.referencedType if issubclass(ty, Pointer) and hasattr(ty, "referencedType") else ty | ||
| if issubclass(immediateType, IntegerImmediate): | ||
| return _broadcastInteger(immediateType) | ||
| if issubclass(immediateType, FloatImmediate): | ||
| return _broadcastFloat(immediateType) | ||
|
|
||
| return None | ||
|
|
||
|
|
@@ -2106,8 +2100,9 @@ def bind(self, ctxt: NetworkContext) -> Tuple[NetworkContext, bool]: | |
| elif ctxt.is_global(node.name): | ||
| npType = self._broadcastToNpType(ctxt.globalObjects[node.name]._type) | ||
| if isinstance(ctxt.globalObjects[node.name], ConstantBuffer): | ||
| if isinstance(node, gs.Constant): | ||
| if isinstance(node, gs.Constant) and npType is not None: | ||
| node.values = node.values.astype(npType) | ||
| node.export_dtype = npType | ||
| else: | ||
| node.shape = ctxt.globalObjects[node.name].shape | ||
| if npType is not None: | ||
|
|
@@ -2583,6 +2578,16 @@ def codeTransform(self, verbose: CodeGenVerbosity = _NoVerbosity): | |
| self.transformed = True | ||
|
|
||
| def _selectEngine(self, node: gs.Node) -> DeploymentEngine: | ||
| if "engine" in node.attrs: | ||
| engineName = node.attrs["engine"] | ||
| for engine in self.Platform.engines: | ||
| if engine.name == engineName: | ||
| if node.op not in engine.Mapping: | ||
| raise RuntimeError(f"No mapping found for node {node.name} with op type {node.op} " | ||
| f"in explicitly selected engine {engineName}") | ||
| return engine | ||
| raise RuntimeError(f"Node {node.name} has an unknown engine {engineName} assigned") | ||
|
|
||
| for engine in self.Platform.engines: | ||
| if node.op in engine.Mapping: | ||
| return engine | ||
|
|
@@ -2863,7 +2868,17 @@ def generateInferenceInitializationCode(self) -> str: | |
|
|
||
| name = node.name | ||
| node.name = self.ctxt._mangle(node.name) | ||
| callStack += node.init() | ||
|
|
||
| if ("TILING_CODEGEN" not in node.name and isinstance(node, VariableBuffer) and hasattr(node, "_type") | ||
| and issubclass(node._type, Pointer)): | ||
| # Local inference buffers are late-bound by the generated layer code. Initializing them to NULL keeps | ||
| # clang from flagging false-positive uninitialized reads on paths where the assignment is emitted in a | ||
| # separate closure, and marking them unused avoids noise for scratch buffers that are reserved | ||
| # generically but optimized away for a specific layer instance. | ||
| typeName = node._instance.typeName if hasattr(node, "_instance") else node._type.typeName | ||
| callStack += f"{typeName} {node.name} __attribute__((unused)) = NULL;\n" | ||
| else: | ||
| callStack += node.init() | ||
| node.name = name | ||
|
|
||
| return callStack | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that these changes were made to adjust your local work env, and should not be pushed to main. Please revert them.