Skip to content
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

[ir] Let the type of ExternalTensorExpression be an ndarray struct #8191

Merged
merged 5 commits into from
Jun 19, 2023

Conversation

lin-hitonami
Copy link
Contributor

@lin-hitonami lin-hitonami commented Jun 15, 2023

🤖 Generated by Copilot at 392b4c4

Summary

🔧🧠🌐

Refactor the ExternalTensorExpression class to use the TypeFactory singleton for creating types of external tensors. This improves the consistency and extensibility of the type system of Taichi.

TypeFactory helps
unify Taichi types for
backend generation

Walkthrough

  • Refactor the type system of external tensors using TypeFactory (link, link)
  • Use TypeFactory::create_vector_or_scalar_type to create a pointer type for the external tensor data in flatten (link)
  • Use TypeFactory::create_struct_type to create a struct type for the external tensor metadata in type_check (link)

Stack from ghstack (oldest at bottom):

…y struct"

<!--
copilot:all
-->
### <samp>🤖 Generated by Copilot at 392b4c4</samp>

### Summary
🔧🧠🌐

<!--
1.  🔧 - This emoji represents a tool or a wrench, and it can be used to indicate a refactoring or a modification of existing code or functionality.
2.  🧠 - This emoji represents a brain or intelligence, and it can be used to indicate a change that involves logic, reasoning, or type system.
3.  🌐 - This emoji represents a globe or the world, and it can be used to indicate a change that involves external or foreign data or interfaces, such as tensors or arrays.
-->
Refactor the `ExternalTensorExpression` class to use the `TypeFactory` singleton for creating types of external tensors. This improves the consistency and extensibility of the type system of Taichi.

> _`TypeFactory` helps_
> _unify Taichi types for_
> _backend generation_

### Walkthrough
*  Refactor the type system of external tensors using `TypeFactory` ([link](https://github.com/taichi-dev/taichi/pull/8191/files?diff=unified&w=0#diff-a6e92dd2dd707d705dc44ef91463ddc0423575188e6e8e0555de9e439db88c35R611), [link](https://github.com/taichi-dev/taichi/pull/8191/files?diff=unified&w=0#diff-0bb8e07f3f606e45f4e4284c02b32f986d420388fdd71b115a7475aacb50a42cL505-R506))
  - Use `TypeFactory::create_vector_or_scalar_type` to create a pointer type for the external tensor data in `flatten` ([link](https://github.com/taichi-dev/taichi/pull/8191/files?diff=unified&w=0#diff-a6e92dd2dd707d705dc44ef91463ddc0423575188e6e8e0555de9e439db88c35R611))
  - Use `TypeFactory::create_struct_type` to create a struct type for the external tensor metadata in `type_check` ([link](https://github.com/taichi-dev/taichi/pull/8191/files?diff=unified&w=0#diff-0bb8e07f3f606e45f4e4284c02b32f986d420388fdd71b115a7475aacb50a42cL505-R506))






[ghstack-poisoned]
…y struct"

<!--
copilot:all
-->
### <samp>🤖 Generated by Copilot at 392b4c4</samp>

### Summary
🔧🧠🌐

<!--
1.  🔧 - This emoji represents a tool or a wrench, and it can be used to indicate a refactoring or a modification of existing code or functionality.
2.  🧠 - This emoji represents a brain or intelligence, and it can be used to indicate a change that involves logic, reasoning, or type system.
3.  🌐 - This emoji represents a globe or the world, and it can be used to indicate a change that involves external or foreign data or interfaces, such as tensors or arrays.
-->
Refactor the `ExternalTensorExpression` class to use the `TypeFactory` singleton for creating types of external tensors. This improves the consistency and extensibility of the type system of Taichi.

> _`TypeFactory` helps_
> _unify Taichi types for_
> _backend generation_

### Walkthrough
*  Refactor the type system of external tensors using `TypeFactory` ([link](https://github.com/taichi-dev/taichi/pull/8191/files?diff=unified&w=0#diff-a6e92dd2dd707d705dc44ef91463ddc0423575188e6e8e0555de9e439db88c35R611), [link](https://github.com/taichi-dev/taichi/pull/8191/files?diff=unified&w=0#diff-0bb8e07f3f606e45f4e4284c02b32f986d420388fdd71b115a7475aacb50a42cL505-R506))
  - Use `TypeFactory::create_vector_or_scalar_type` to create a pointer type for the external tensor data in `flatten` ([link](https://github.com/taichi-dev/taichi/pull/8191/files?diff=unified&w=0#diff-a6e92dd2dd707d705dc44ef91463ddc0423575188e6e8e0555de9e439db88c35R611))
  - Use `TypeFactory::create_struct_type` to create a struct type for the external tensor metadata in `type_check` ([link](https://github.com/taichi-dev/taichi/pull/8191/files?diff=unified&w=0#diff-0bb8e07f3f606e45f4e4284c02b32f986d420388fdd71b115a7475aacb50a42cL505-R506))






[ghstack-poisoned]
@taichi-gardener taichi-gardener merged commit 23c9834 into gh/lin-hitonami/10/base Jun 19, 2023
taichi-gardener pushed a commit that referenced this pull request Jun 19, 2023
ghstack-source-id: 8b5cea534c215bcacff943ff89294700ffa63ce3
Pull Request resolved: #8191
@taichi-gardener taichi-gardener deleted the gh/lin-hitonami/10/head branch June 19, 2023 01:25
L2ncE pushed a commit to L2ncE/taichi that referenced this pull request Jun 20, 2023
ghstack-source-id: 8b5cea534c215bcacff943ff89294700ffa63ce3
Pull Request resolved: taichi-dev#8191
PGZXB pushed a commit to PGZXB/taichi that referenced this pull request Jul 13, 2023
ghstack-source-id: 8b5cea534c215bcacff943ff89294700ffa63ce3
Pull Request resolved: taichi-dev#8191
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants