alibaba / alibaba/xoc

Allow targets to be added at runtime

Open
#8 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
117
Forks
58
PR merge metrics
No merged PRs in 30d

Description

Hey @stevenknown. I've been working on a Conan package for XOC.

One issue I see is that XOC builds with its targets at compile time (by default it supports DEX). This makes it hard to make a package because the XOC binary that gets installed by a package manager will only support DEX.

This design is ok for LLVM because it comes with many targets and most users won't make their own target. But XOC only supports DEX so most users will have to implement their own target, which means they cannot use a precompiled package.

I don't know much about the XOC design, but I'm wondering if it's possible to support something like this:

Library header in XOC
```c++
// A target interface that users can implement.
class XocTarget {
virtual void func1() = 0;
virtual void func2() = 0;
virtual void func3() = 0;
...
};
```

Application code using XOC
```c++
// Implementing our own target.
class CustomTarget : public XocTarget {
void func1() override;
...
};

...

// Now passing it into XOC so the library can use it.
int main(int argc, char** argv) {
CustomTarget target;
xoc_register_target(&target);

REGION_MGR rm;
rm.init_var_mgr();
...
}
```

If we can't support adding targets at runtime, then I don't think XOC can be packaged. I'm happy to help with the development work.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by tracing where XOC's targets are selected and registered at compile time, including how the DEX target is included. Then determine whether the proposed XocTarget interface and xoc_register_target flow fit the current design. Done means a custom target can be supplied to a precompiled XOC package rather than requiring the binary to be rebuilt.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.