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

[vm][cfe][frontend_server] Make "native_assets.yaml" reusable #55826

Open
dcharkes opened this issue May 23, 2024 · 1 comment
Open

[vm][cfe][frontend_server] Make "native_assets.yaml" reusable #55826

dcharkes opened this issue May 23, 2024 · 1 comment
Assignees
Labels
area-front-end Use area-front-end for front end / CFE / kernel format related issues. area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. cfe-frontend-server Frontend server issues for the CFE front-end-server Issues with the frontend server

Comments

@dcharkes
Copy link
Contributor

For native assets, we've added the ability to embed some extra information in a kernel file that is read by the vm.

  • The extra info is added by passing a nativeAssets param or --native-assets=path/to/a/native_assets.yaml into kernel compilation.
  • The extra info is compiled into the kernel as a @pragma('vm:ffi:native-assets' , { // ... }) library "vm:ffi:native-assets";.
  • The format of the map inside the pragma is tailored to native assets (it's a map from Target (aka Abi) to map from asset id to path).

For adding data assets (#54003), we need something similar, but we don't care about Target/Abi. So shoehorning it into native_assets.yaml is not clean.

Adding a data_assets.yaml and an extra parameter everywhere in the kernel compilation (CFE, frontend server, etc.) doesn't seem very clean. Instead we should consider replacing the native_assets.yaml with some embed_in_kernel.json, that has as a top level key a native_code_assets which contains the current native_assets.yaml contents. Then subsequent types of info to be embedded in a kernel file and accessed from them VM don't have to do any changes in all the various places where kernel is compiled.

We could ease the roll of this migration by having the current flag/param being able to consume the new format first, and adding the flag/param everywhere before removing the old one.

Any new keys added would still be validated in pkg/vm/lib/native_assets/validator.dart because we'd only be adding metadata that is read by the vm. (The file should be renamed to pkg/vm/lib/metadata/validator.dart.)

Naming:

  • It is some kind of metadata.
  • It is embedded in the kernel file.
  • It is read in the VM.

Possibilities:

  • vm_metadata.json, --vm-metadata=path/to/vm_metadata.json and --vm-metadata-only (cmd invocations of gen_kernel), String? vmMetadata (dart API), vm-metadata $uri\n and vm-metadata-only\n in frontend server protocol, and vm:metadata (library name, and pragma name).
  • .. ?

@mkustermann Any suggestions for better naming?

@alexmarkov's suggestion is "metadata" #50152 (comment)

FYI @mosuem (We need to make this piece of infra reusable before putting the data assets mapping in the kernel file)

FYI @jensjoha Sorry for the churn, now I want to rename everything we did in the CFE and frontend_server! 😅

@dcharkes dcharkes added area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. area-front-end Use area-front-end for front end / CFE / kernel format related issues. front-end-server Issues with the frontend server cfe-frontend-server Frontend server issues for the CFE labels May 23, 2024
@dcharkes dcharkes self-assigned this May 23, 2024
@dcharkes
Copy link
Contributor Author

Data assets might also be supported in other backends than the VM in the future. So we should probably not call it vm_metadata either. metadata seems too generic though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-front-end Use area-front-end for front end / CFE / kernel format related issues. area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. cfe-frontend-server Frontend server issues for the CFE front-end-server Issues with the frontend server
Projects
None yet
Development

No branches or pull requests

1 participant