Skip to content

Conversation

@mengshyu
Copy link
Contributor

@mengshyu mengshyu commented Apr 8, 2024

This PR adds OpenCL device for automatic target detection

@echuraev
Copy link
Contributor

echuraev commented Apr 8, 2024

Please, add CI tests.

@mengshyu mengshyu changed the title [OpenCL] Add OpenCL device for automatic target detection. [OpenCL] Add OpenCL device for automatic target detection Apr 8, 2024
@mengshyu mengshyu force-pushed the main branch 2 times, most recently from 0207627 to 547140c Compare April 8, 2024 14:54
def _detect_opencl(dev: Device) -> Target:
return Target(
{
"kind": "opencl",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In some cases, we can initialize OpenCL target with specifying specific device, e.g.:

target = Target("opencl -device=mali", host="llvm -mtriple=aarch64-linux-gnu")
or
target = Target("opencl -device=adreno", host="llvm -mtriple=arm64-linux-android")

Can we handle these cases somehow?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I have verified on Orange Pi.

Screenshot from 2024-04-09 12-56-06

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, probably my question wasn't clear. Yes, I know that we can get such information from target. But I'm curious if we can get this information from the device somehow?

Probably, we can specify by an addition parameter to Target.from_device(input_device). For example: Target.from_device(input_device, '-device=adreno') will specify target as "kind": "opencl -device=adreno". Does it make sense?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems there is no argument for '-device=adreno' in API Target.from_device.

This PR intends to fix weight conversion for MLC LLM on OrangePi (#1557), assuming there are no other issues. I would like to merge it first. If you have any suggestions, perhaps we can create another issue to discuss. Thanks.

This PR adds OpenCL device for automatic target detection.
@mengshyu
Copy link
Contributor Author

mengshyu commented Apr 9, 2024

Please, add CI tests.

Hi @echuraev
Thanks for your suggestion, I added a test case in tests/python/target/test_target_target.py

Copy link
Contributor

@echuraev echuraev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general LGTM. Thanks!

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

Successfully merging this pull request may close these issues.

3 participants