Skip to content

[Android] Add a Runtime.java #10439

Open
@kirklandsign

Description

@kirklandsign

🚀 The feature, motivation and pitch

Right now we have two places loading library https://github.com/search?q=repo%3Apytorch%2Fexecutorch%20loadlib&type=code

Instead, can we just have one place, in a new file say Runtime.java?

class Runtime {
static {
  // Loads libexecutorch.so from jniLibs
  NativeLoader.loadLibrary("executorch");
}

static boolean isInitialized() {
  // maybe check something else?
}
}

Then in NativePeer.java and LlmModule.java

static {
  if (!Runtime.isInitialized()) {
    throw ...
  }
}

Alternatives

No response

Additional context

No response

RFC (Optional)

No response

cc @cbilgin

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueGood for newcomersmodule: androidIssues related to Android code, build, and executiontriagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate module

    Projects

    Status

    No status

    Status

    Todo

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions