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

Changed bnns tests to support RPC tracker and integrate them into CI #9

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

KJlaccHoeUM9l
Copy link

X64_X86 = 0
ARM64 = 1

connection_type = ConnectionType("local")
Copy link

Choose a reason for hiding this comment

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

Move to instance field

@@ -180,13 +212,15 @@ def build_and_run(
return out


def update_lib(lib, device, cross_compile):
def update_lib(lib, device, cross_compile, lib_export_type):
Copy link

Choose a reason for hiding this comment

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

We may remove cross_compile args for our cases.

lib.export_library(lib_path, cc=cross_compile)
if lib_export_type == Device.LibExportType.ARM64:
lib.export_library(lib_path, xcode.create_dylib, arch="arm64", sdk="iphoneos")
Copy link

Choose a reason for hiding this comment

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

move this branch into details of Device object.
The first way is:

lib.export_library(lib_path, _device.fcompile, _device.fcompile_kwargs)

The second way:

lib.export_library(lib_path, _device.fcompile)

***
def my_create_dylib(output, objects, *kwargs):
    xcode.create_dylib(output, objects, arch="arm64", sdk="phones", **kwargs)

_device.fcompile =  my_create_dylib

"""Skip test if it requires the BNNS codegen and it's not present."""
if not tvm.get_global_func("relay.ext.bnns", True):
print("Skip because BNNS codegen is not available.")
def have_device_and_tracker_variables():
Copy link

Choose a reason for hiding this comment

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

I suggest to move this check into Device class object. Like a Device.is_tracker_compatible()

cls.device_key = os.environ[Device.EnvironmentVariables.TVM_REMOTE_DEVICE_KEY.value]

cls.target = "llvm -mtriple=arm64-apple-darwin"
cls.lib_export_type = Device.LibExportType.ARM64
Copy link

Choose a reason for hiding this comment

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

Move lib_export_type, target and connection_type to instance field.
Initialisation of all other move to constructor of class object.

return [Device.ConnectionType.LOCAL, Device.ConnectionType.TRACKER]


def skip_complexity_test():
Copy link

Choose a reason for hiding this comment

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

Can be formulated as special decorator

@KJlaccHoeUM9l
Copy link
Author

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.

2 participants