FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Fp16 print fix by syurkevi · Pull Request #2784 · arrayfire/arrayfire · GitHub

Repository navigation

Fp16 print fix - #2784

Merged
umar456 merged 2 commits into
arrayfire:masterfrom
syurkevi:fp16_print_fix
Mar 25, 2020
Merged

umar456 merged 2 commits into
arrayfire:masterfrom
syurkevi:fp16_print_fix

Conversation

syurkevi commented Mar 4, 2020

Copy link
Copy Markdown
Contributor

Adds missing print in array_to_string.
Also checks if half type is supported during array creation in cuda backend.

!isHalfSupported(getActiveDeviceId())) {
AF_ERROR("Half precision not supported", AF_ERR_NO_HALF);
}
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I think we should move this to src/backend/common or src/api/c since this can be used from other locations too.

Also, Don't we need similar checks in create*Array helpers in others backends too ?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

This is already done in the OpenCL backend. It was not done in this backend because I intended to support half on older hardware and forgot to put it back in once I abandoned that idea.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

In that case, lets try to move this check into src/api/c/ a more common location is perhaps af_create_array ?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

lots of functions create arrays. for example randu. I think implementing it in the common namespace is sufficient.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Whichever location makes sense most.

WilliamTambellini left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Warning: this could easily kill perf for users creating thousand of small arrays per secs : have you checked the impact of checkTypeSupported on perf ?
Example:

  • in a for loop, just create arrays of random shapes (to bypass the GC buffer, or turn off GC)
  • track the time to do all these creations
  • compare with and without this checkTypeSupported
    ?

9prady9 commented Mar 9, 2020

Copy link
Copy Markdown
Member

Warning: this could easily kill perf for users creating thousand of small arrays per secs : have you checked the impact of checkTypeSupported on perf ?
Example:

* in a for loop, just create arrays of random shapes (to bypass the GC buffer, or turn off GC)

* track the time to do all these creations

* compare with and without this checkTypeSupported
  ?

I am not sure if these checks are avoided for fp16 for the reasons @WilliamTambellini mentioned. Having said that, some sort of check is required at some location I would think. @umar456 Can you please confirm if this is intentional or if check is done else where ?

umar456 commented Mar 9, 2020

Copy link
Copy Markdown
Member

I don't think this check is going to be very expensive but it may be a good idea to memoize the result of the call for each device.

}

bool isHalfSupported(int device) {
auto prop = getDeviceProp(device);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Isn't getDeviceProp inexpensive ?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Yes but this will be slightly faster.

umar456 merged commit cd3c107 into arrayfire:master Mar 25, 2020
9prady9 deleted the fp16_print_fix branch March 25, 2020 05:01
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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.

4 participants


Back | FazBrowse Home | New Git URL