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

[component model] instantiate #3218

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
Open

Conversation

dannypsnl
Copy link
Member

@dannypsnl dannypsnl commented Feb 15, 2024

#3151

  1. [component model] linear indexed space
    1. instance section
      1. inline export immediate module instance
      2. instantiate module instance via module definition
      3. instantiate component instance via component definition
    2. canonical section
      1. lift: wrap a core module function with component types
      2. lower: wrap a component function with core types
    3. alias definitions
    4. import definitions
    5. export definitions
    6. type section (record into a index space)
  2. [wasi-http] a test component in wasi-http plugin, the demo helps us to interact with canonical ABI
  3. [wasi-poll] standard plugin
  4. [formatter] format component types and AST::FunctionType

Copy link
Member

juntao commented Feb 15, 2024

Hello, I am a code review bot on flows.network. Here are my reviews of code commits in this PR.


@dannypsnl dannypsnl force-pushed the component-model/instantiate branch 3 times, most recently from 98f8cf5 to 0524918 Compare February 23, 2024 07:33
@dannypsnl dannypsnl force-pushed the component-model/instantiate branch 2 times, most recently from 263b7e6 to 1ae315b Compare March 4, 2024 05:57
@github-actions github-actions bot added the c-Plugin An issue related to WasmEdge Plugin label Mar 4, 2024
@dannypsnl dannypsnl force-pushed the component-model/instantiate branch from 702105e to 2ee0a0e Compare March 6, 2024 06:29
@dannypsnl dannypsnl marked this pull request as ready for review March 11, 2024 08:59
@hydai hydai added the v-0.14.0 label Mar 11, 2024
@dannypsnl dannypsnl force-pushed the component-model/instantiate branch 2 times, most recently from 0c1460e to 749d4c3 Compare March 12, 2024 12:23
plugins/wasi_http/func.cpp Outdated Show resolved Hide resolved
plugins/wasi_http/func.cpp Outdated Show resolved Hide resolved
plugins/wasi_http/func.cpp Outdated Show resolved Hide resolved
include/runtime/instance/component.h Outdated Show resolved Hide resolved
lib/executor/instantiate/component.cpp Show resolved Hide resolved
lib/executor/instantiate/component.cpp Outdated Show resolved Hide resolved
lib/executor/instantiate/component.cpp Outdated Show resolved Hide resolved
lib/executor/instantiate/component.cpp Outdated Show resolved Hide resolved
@dannypsnl

This comment was marked as resolved.

Copy link

codecov bot commented Mar 14, 2024

Codecov Report

Attention: Patch coverage is 3.88769% with 890 lines in your changes are missing coverage. Please review.

Project coverage is 77.78%. Comparing base (212e909) to head (26b64b1).

Files Patch % Lines
lib/executor/instantiate/component/canon.cpp 0.00% 216 Missing ⚠️
include/ast/component/type.h 0.00% 169 Missing ⚠️
lib/executor/instantiate/component/instance.cpp 0.00% 95 Missing ⚠️
include/runtime/instance/component.h 0.00% 80 Missing ⚠️
lib/executor/instantiate/component/alias.cpp 0.00% 77 Missing ⚠️
lib/executor/instantiate/component.cpp 0.00% 49 Missing ⚠️
lib/vm/vm.cpp 49.18% 25 Missing and 6 partials ⚠️
lib/executor/instantiate/component/import.cpp 0.00% 30 Missing ⚠️
lib/executor/instantiate/component/export.cpp 0.00% 26 Missing ⚠️
include/runtime/instance/module.h 0.00% 19 Missing ⚠️
... and 11 more
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3218      +/-   ##
==========================================
- Coverage   79.83%   77.78%   -2.06%     
==========================================
  Files         253      262       +9     
  Lines       34948    35888     +940     
  Branches     6122     6456     +334     
==========================================
+ Hits        27902    27914      +12     
- Misses       5622     6547     +925     
- Partials     1424     1427       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@dannypsnl

This comment was marked as resolved.

@hydai

This comment was marked as resolved.

@dannypsnl dannypsnl force-pushed the component-model/instantiate branch 3 times, most recently from 44b2deb to 369906b Compare March 20, 2024 09:11
@dannypsnl dannypsnl force-pushed the component-model/instantiate branch 2 times, most recently from aa1d588 to f51430d Compare March 25, 2024 17:59
@dannypsnl dannypsnl force-pushed the component-model/instantiate branch 2 times, most recently from 3436114 to d61259d Compare May 13, 2024 05:06
@github-actions github-actions bot added the c-CI label May 14, 2024
@dannypsnl dannypsnl force-pushed the component-model/instantiate branch from f67917d to d61259d Compare May 14, 2024 10:52
@github-actions github-actions bot removed the c-CI label May 14, 2024
@dannypsnl dannypsnl force-pushed the component-model/instantiate branch from d61259d to fdb35e5 Compare May 14, 2024 10:53
@dannypsnl dannypsnl force-pushed the component-model/instantiate branch from 1a908d8 to f25bc16 Compare May 27, 2024 07:57
@hydai hydai added v-0.14.1 and removed v-0.14.0 labels May 27, 2024
@dannypsnl dannypsnl force-pushed the component-model/instantiate branch 2 times, most recently from edf18b4 to fa0f78c Compare May 30, 2024 01:18
* section order will affect index space
* skip validation process for now
* nested core module instantiation
* record all environments had been used
* add type and core:type into index space (in component instance)
* (FIXME) import section: the current implementation will treat a plugin
  as module instance instead a component instance, in the end we should
  have both
* instantiate component sort part
* export function instance out, so we can run it from CLI
  * canoncial lift without options
  * canoncial lower without options
* unify component and module instance in VM
* drafting inline exports concept

Signed-off-by: Lîm Tsú-thuàn <dannypsnl@secondstate.io>
* wasi-http implementation
* drafting example for test
* fix a bug in store manager, soft modules do it wrong
* fix instance problem
misc
* update to follow review feedback
* mark TODO
* add prefix
* reinterpret_cast
* format stuff

Signed-off-by: Lîm Tsú-thuàn <dannypsnl@secondstate.io>
- canonical changes
- extracting out the instantiate of each section to its own file
- `alias` is correct, the bug is coming from the demo code

Signed-off-by: Lîm Tsú-thuàn <dannypsnl@secondstate.io>
1. [component] create `Executor::lowering` function that gets a higher
   function instance, returns a lower function instance
2. add enum `TypeCode::String`
3. add `StrVariant` so host function can operate string
4. [plugin] update wasi-http implementation to use new stuffs

Signed-off-by: Lîm Tsú-thuàn <dannypsnl@secondstate.io>
* pushing canonical lifting a bit, now call flow has no error came out
* add header
* cannot allocate ValVariant
  * `vector` of component instance use push_back
* fix test build
  * remove const descriptor
  * avoid occurs casting which will fail on some platforms
  * remove `const`
  * proper initialize
  * anonymous namespace
* lift lower function that occurs string correctly

misc
* mark TODO
* use hard code version to allocate string in memory
* abort execution if run into unimplemented option
* add formatter for AST type
* use formatter

Signed-off-by: Lîm Tsú-thuàn <dannypsnl@secondstate.io>
misc
* complete defined value type formatter
* format the Component function type

Signed-off-by: Lîm Tsú-thuàn <dannypsnl@secondstate.io>
NOTE: some internal bugs still there, so the demo haven't fully work yet.

Signed-off-by: Lîm Tsú-thuàn <dannypsnl@secondstate.io>
misc: remove unused code

Signed-off-by: Lîm Tsú-thuàn <dannypsnl@secondstate.io>
misc
* missing `break` in cases
* adjustment

Signed-off-by: Lîm Tsú-thuàn <dannypsnl@secondstate.io>
Signed-off-by: Lîm Tsú-thuàn <dannypsnl@secondstate.io>
…ng content

misc
* missing `break`
* reduce interface of `StrVariant`

Signed-off-by: Lîm Tsú-thuàn <dannypsnl@secondstate.io>
misc: format

Signed-off-by: Lîm Tsú-thuàn <dannypsnl@secondstate.io>
Signed-off-by: Lîm Tsú-thuàn <dannypsnl@secondstate.io>
Signed-off-by: Lîm Tsú-thuàn <dannypsnl@secondstate.io>
Signed-off-by: Lîm Tsú-thuàn <dannypsnl@secondstate.io>
Signed-off-by: Lîm Tsú-thuàn <dannypsnl@secondstate.io>
Signed-off-by: Lîm Tsú-thuàn <dannypsnl@secondstate.io>
@dannypsnl dannypsnl force-pushed the component-model/instantiate branch from fa0f78c to 26b64b1 Compare June 3, 2024 02:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c-CLI An issue related to WasmEdge CLI tools c-Plugin An issue related to WasmEdge Plugin c-Test An issue/PR to enhance the test suite c-WASI-NN v-0.14.1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants