-
Notifications
You must be signed in to change notification settings - Fork 40
Upgrade to WAMR 2.4.1 and WASI SDK to v27 #515
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
Closed
+798
−607
Closed
Changes from 12 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
bbe8bbe
Allow varargs with the error exceptions
cmickeyb f4b6b61
EXPERIMENT: force finalization of state cache to ensure full clean up
cmickeyb acd6c10
update WAMR 2.4.1
cmickeyb 13e588c
Bump WASI version to 27
cmickeyb ac5bbfd
Make parson serialization of numbers work with WAMR 2.4
cmickeyb 36b141d
Move memory configuration into a single cmake include
cmickeyb 598b895
Incorporate the centralized memory configuration into state
cmickeyb 442febd
Update Wawaka interpreter for WAMR 2.4.1
cmickeyb d9e350a
EXPERIMENT: reduce number of enclave instances to 1
cmickeyb 35a178c
address copilot PR feedback
cmickeyb fcb66f1
small cleanups in the state code
cmickeyb 7b28bb4
clean up the wawaka kvstore table more thoroughly
cmickeyb 8a17e5d
Update eservice/lib/libpdo_enclave/contract_request.cpp
cmickeyb e3bbff3
Update eservice/lib/libpdo_enclave/contract_request.cpp
cmickeyb File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,99 @@ | ||
| # Copyright 2025 Intel Corporation | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| ################################################################################ | ||
| # Memory size configuration | ||
| ################################################################################ | ||
|
|
||
| # The memory size option configures enclave and interpreter memory | ||
| # size values. The variable may have the value of "SMALL", "MEDIUM" or | ||
| # "LARGE". This is a project variable because the configurations | ||
| # depend on one another (the interpreter heap size must fit into the | ||
| # enclave heap, for example). | ||
| SET(PDO_MEMORY_CONFIG "MEDIUM" CACHE STRING "Set memory size parameters for enclave and interpreter") | ||
| IF (DEFINED ENV{PDO_MEMORY_CONFIG}) | ||
| SET(PDO_MEMORY_CONFIG $ENV{PDO_MEMORY_CONFIG}) | ||
| ENDIF() | ||
| SET(MEMORY_SIZE_OPTIONS "SMALL" "MEDIUM" "LARGE") | ||
| IF (NOT ${PDO_MEMORY_CONFIG} IN_LIST MEMORY_SIZE_OPTIONS) | ||
| MESSAGE(FATAL_ERROR "Invalid memory size; ${PDO_MEMORY_CONFIG}") | ||
| ENDIF() | ||
|
|
||
| # Module heap and stack, these are related to the contract maximum | ||
| # size, we could specify these and derive the maximum contract size | ||
| # from them | ||
| IF (${PDO_MEMORY_CONFIG} STREQUAL "SMALL") | ||
| MATH(EXPR CONTRACT_HEAP_SIZE "2 * 1024 * 1024") | ||
| MATH(EXPR CONTRACT_STACK_SIZE "1 * 1024 * 1024") | ||
| ELSEIF (${PDO_MEMORY_CONFIG} STREQUAL "MEDIUM") | ||
| MATH(EXPR CONTRACT_HEAP_SIZE "4 * 1024 * 1024") | ||
| MATH(EXPR CONTRACT_STACK_SIZE "2 * 1024 * 1024") | ||
| ELSEIF (${PDO_MEMORY_CONFIG} STREQUAL "LARGE") | ||
| MATH(EXPR CONTRACT_HEAP_SIZE "8 * 1024 * 1024") | ||
| MATH(EXPR CONTRACT_STACK_SIZE "4 * 1024 * 1024") | ||
| ELSE() | ||
| MESSAGE(FATAL_ERROR "Invalid memory size; ${PDO_MEMORY_CONFIG}") | ||
| ENDIF() | ||
|
|
||
| # This determines the reserved memory size in the enclave, that is, | ||
| # the interpreters linear memory is currently stored in the enclave | ||
| # reserve memory. The padding is expected to be constant over the | ||
| # size of the contract. | ||
| MATH(EXPR CONTRACT_PADDING "1 * 1024 * 1024") | ||
| MATH(EXPR CONTRACT_MAXIMUM_SIZE "${CONTRACT_HEAP_SIZE} + ${CONTRACT_STACK_SIZE} + ${CONTRACT_PADDING}") | ||
|
|
||
| # Global heap is used for the management structures that store WAMR | ||
| # state information, not specific to the module or contract size. This | ||
| # memory is allocated from the enclave heap/stack. Note that it is | ||
| # difficult (and not particularly well documented) to determine what | ||
| # this number should be. The current computation represents a best | ||
| # guess and will need to be adjusted as appropriate. | ||
| MATH(EXPR CONTRACT_GLOBAL_HEAP_SIZE "4 * 1024 * 1024 + ${CONTRACT_MAXIMUM_SIZE}") | ||
|
|
||
| # State cache size is one of the main consumers of memory, probably impacts | ||
| # both enclave stack and heap, the state data block size is probably not | ||
| # important enough to provide variable sizing. Should probably just set it | ||
| # to 8K and leave it. | ||
| MATH(EXPR STATE_CACHE_SIZE "4 * 1024 * 1024") | ||
| MATH(EXPR STATE_DATA_BLOCK_SIZE "8 * 1024") | ||
|
|
||
| # The worker stack and heap sizes are per-thread allocations. The heap | ||
| # size must be large enough to hold the state cache, the global heap, and | ||
| # some padding. For now, the stack size is a fraction of the heap. | ||
| MATH(EXPR ENCLAVE_WORKER_HEAP "${STATE_CACHE_SIZE} + ${CONTRACT_GLOBAL_HEAP_SIZE} + ${CONTRACT_MAXIMUM_SIZE}") | ||
| MATH(EXPR ENCLAVE_WORKER_STACK "${ENCLAVE_WORKER_HEAP} / 4") | ||
|
|
||
| # The WAMR requirement for reserved memory is the WAMR heap size plus | ||
| # the total memory required by the WASM module that is loaded. We can | ||
| # set a limit here and trust the wawaka module to enforce the | ||
| # limit. Note that the contract heap is double counted (explicitly and | ||
| # again in the contract maximum size). This is a reflection of how the | ||
| # contract interpreter handles reserved memory allocation. | ||
| MATH(EXPR ENCLAVE_WORKER_RESERVED_SIZE "${CONTRACT_HEAP_SIZE} + ${CONTRACT_MAXIMUM_SIZE}") | ||
|
|
||
| # The worker thread count corresponds roughly to the expected number | ||
| # of concurrent workers in the enclave, each will allocate memory to | ||
| # the contract interpreter. | ||
| SET(ENCLAVE_WORKER_THREADS "2") | ||
|
|
||
| # Heap padding is memory expected to be used by the enclave outside | ||
| # the interpreter (that is, it does not depend on the configuration of | ||
| # the interpreter). | ||
| MATH(EXPR ENCLAVE_STACK_PADDING "4 * 1024 * 1024") | ||
| MATH(EXPR ENCLAVE_HEAP_PADDING "4 * 1024 * 1024") | ||
|
|
||
| # And the final numbers allocate enough space for each worker plus the shared padding | ||
| MATH(EXPR ENCLAVE_STACK_SIZE "${ENCLAVE_WORKER_THREADS} * ${ENCLAVE_WORKER_STACK} + ${ENCLAVE_STACK_PADDING}") | ||
| MATH(EXPR ENCLAVE_HEAP_SIZE "${ENCLAVE_WORKER_THREADS} * ${ENCLAVE_WORKER_HEAP} + ${ENCLAVE_HEAP_PADDING}") | ||
| MATH(EXPR ENCLAVE_RESERVED_SIZE "${ENCLAVE_WORKER_THREADS} * ${ENCLAVE_WORKER_RESERVED_SIZE}") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.