|
| 1 | +//***************************************************************************** |
| 2 | +// Copyright (c) 2023, Intel Corporation |
| 3 | +// All rights reserved. |
| 4 | +// |
| 5 | +// Redistribution and use in source and binary forms, with or without |
| 6 | +// modification, are permitted provided that the following conditions are met: |
| 7 | +// - Redistributions of source code must retain the above copyright notice, |
| 8 | +// this list of conditions and the following disclaimer. |
| 9 | +// - Redistributions in binary form must reproduce the above copyright notice, |
| 10 | +// this list of conditions and the following disclaimer in the documentation |
| 11 | +// and/or other materials provided with the distribution. |
| 12 | +// |
| 13 | +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
| 14 | +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 15 | +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 16 | +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE |
| 17 | +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
| 18 | +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
| 19 | +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
| 20 | +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
| 21 | +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| 22 | +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF |
| 23 | +// THE POSSIBILITY OF SUCH DAMAGE. |
| 24 | +//***************************************************************************** |
| 25 | + |
| 26 | +#pragma once |
| 27 | + |
1 | 28 | #include <array>
|
2 | 29 | #include <tuple>
|
3 | 30 |
|
@@ -387,86 +414,6 @@ struct UsmArrayMatcher
|
387 | 414 | }
|
388 | 415 | };
|
389 | 416 |
|
390 |
| -// int typenum_to_lookup_id(int typenum) const |
391 |
| -// { |
392 |
| -// using typenum_t = ::dpctl::tensor::type_dispatch::typenum_t; |
393 |
| -// auto const &api = ::dpctl::detail::dpctl_capi::get(); |
394 |
| - |
395 |
| -// if (typenum == api.UAR_DOUBLE_) { |
396 |
| -// return static_cast<int>(typenum_t::DOUBLE); |
397 |
| -// } |
398 |
| -// else if (typenum == api.UAR_INT64_) { |
399 |
| -// return static_cast<int>(typenum_t::INT64); |
400 |
| -// } |
401 |
| -// else if (typenum == api.UAR_INT32_) { |
402 |
| -// return static_cast<int>(typenum_t::INT32); |
403 |
| -// } |
404 |
| -// else if (typenum == api.UAR_BOOL_) { |
405 |
| -// return static_cast<int>(typenum_t::BOOL); |
406 |
| -// } |
407 |
| -// else if (typenum == api.UAR_CDOUBLE_) { |
408 |
| -// return static_cast<int>(typenum_t::CDOUBLE); |
409 |
| -// } |
410 |
| -// else if (typenum == api.UAR_FLOAT_) { |
411 |
| -// return static_cast<int>(typenum_t::FLOAT); |
412 |
| -// } |
413 |
| -// else if (typenum == api.UAR_INT16_) { |
414 |
| -// return static_cast<int>(typenum_t::INT16); |
415 |
| -// } |
416 |
| -// else if (typenum == api.UAR_INT8_) { |
417 |
| -// return static_cast<int>(typenum_t::INT8); |
418 |
| -// } |
419 |
| -// else if (typenum == api.UAR_UINT64_) { |
420 |
| -// return static_cast<int>(typenum_t::UINT64); |
421 |
| -// } |
422 |
| -// else if (typenum == api.UAR_UINT32_) { |
423 |
| -// return static_cast<int>(typenum_t::UINT32); |
424 |
| -// } |
425 |
| -// else if (typenum == api.UAR_UINT16_) { |
426 |
| -// return static_cast<int>(typenum_t::UINT16); |
427 |
| -// } |
428 |
| -// else if (typenum == api.UAR_UINT8_) { |
429 |
| -// return static_cast<int>(typenum_t::UINT8); |
430 |
| -// } |
431 |
| -// else if (typenum == api.UAR_CFLOAT_) { |
432 |
| -// return static_cast<int>(typenum_t::CFLOAT); |
433 |
| -// } |
434 |
| -// else if (typenum == api.UAR_HALF_) { |
435 |
| -// return static_cast<int>(typenum_t::HALF); |
436 |
| -// } |
437 |
| -// else if (typenum == api.UAR_INT_ || typenum == api.UAR_UINT_) { |
438 |
| -// switch (sizeof(int)) { |
439 |
| -// case sizeof(std::int32_t): |
440 |
| -// return ((typenum == api.UAR_INT_) |
441 |
| -// ? static_cast<int>(typenum_t::INT32) |
442 |
| -// : static_cast<int>(typenum_t::UINT32)); |
443 |
| -// case sizeof(std::int64_t): |
444 |
| -// return ((typenum == api.UAR_INT_) |
445 |
| -// ? static_cast<int>(typenum_t::INT64) |
446 |
| -// : static_cast<int>(typenum_t::UINT64)); |
447 |
| -// default: |
448 |
| -// throw_unrecognized_typenum_error(typenum); |
449 |
| -// } |
450 |
| -// } |
451 |
| -// else if (typenum == api.UAR_LONGLONG_ || typenum == api.UAR_ULONGLONG_) |
452 |
| -// { |
453 |
| -// switch (sizeof(long long)) { |
454 |
| -// case sizeof(std::int64_t): |
455 |
| -// return ((typenum == api.UAR_LONGLONG_) |
456 |
| -// ? static_cast<int>(typenum_t::INT64) |
457 |
| -// : static_cast<int>(typenum_t::UINT64)); |
458 |
| -// default: |
459 |
| -// throw_unrecognized_typenum_error(typenum); |
460 |
| -// } |
461 |
| -// } |
462 |
| -// else { |
463 |
| -// throw_unrecognized_typenum_error(typenum); |
464 |
| -// } |
465 |
| -// // return code signalling error, should never be reached |
466 |
| -// assert(false); |
467 |
| -// return -1; |
468 |
| -// } |
469 |
| - |
470 | 417 | template <>
|
471 | 418 | bool UsmArrayMatcher::match<int8_t>(const dpctl::tensor::usm_ndarray &arr)
|
472 | 419 | {
|
|
0 commit comments