8000 Allow targets to be added at runtime · Issue #8 · alibaba/xoc · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Allow targets to be added at runtime #8

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

Open
tetsuo-cpp opened this issue Mar 28, 2021 · 3 comments
Open

Allow targets to be added at runtime #8

tetsuo-cpp opened this issue Mar 28, 2021 · 3 comments

Comments

@tetsuo-cpp
Copy link
tetsuo-cpp commented Mar 28, 2021

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

// 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

// 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.

@stevenknown
Copy link
Contributor

XOC indeed does not support dynamic allocating different Targets at runtime, one of the reason for this is that it is expected to improve compilation speed by using compile-time constants. But I believe dynamic target allocation is an very important feature for multiple-targets compiler, I actually considered support it before.
BTW because the submission review of this branch is very slowly, could you submit code to forked branch stevenknown/xoc, it is updated more quickly. :)

@tetsuo-cpp
Copy link
Author

But I believe dynamic target allocation is an very important feature for multiple-targets compiler, I actually considered support it before.

Fantastic. Should I write some draft code to support dynamic target allocation? Once I get it working and open a PR, we can discuss and improve my design.

BTW because the submission review of this branch is very slowly, could you submit code to forked branch stevenknown/xoc, it is updated more quickly. :)

874F

Understood! I submitted my other code change at stevenknown/xoc. But unfortunately, I'm not able to file issues on your repo (maybe because it is a fork?).

@stevenknown
Copy link
Contributor
stevenknown commented Mar 30, 2021

Fine! You could have a try first. And there are some commercial version branch that are not open source. May be I could cherrypick the new big feature into them when we done.

Understood! I submitted my other code change at stevenknown/xoc. But unfortunately, I'm not able to file issues on your repo (maybe because it is a fork?).

Did you mean PR with commit-id 4c3559f? I have merged it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
0