OFS / oneapi-asp

Intel® oneAPI Accelerator Support Package (ASP)
MIT License
2 stars 8 forks source link

Shared memory allocation example (Tutorials/Gettingstarted/fpga_compile/part2_dpcpp_functor_usm) not working on Intel N6001 board #140

Open umairsiddiqui-digitek opened 3 months ago

umairsiddiqui-digitek commented 3 months ago

i am able to run board_test application https://github.com/oneapi-src/oneAPI-samples/tree/master/DirectProgramming/C%2B%2BSYCL_FPGA/ReferenceDesigns/board_test

which has USM memory test.

But I am not able to run the Shared memory allocation example on Intel N6001 board

https://github.com/oneapi-src/oneAPI-samples/tree/master/DirectProgramming/C%2B%2BSYCL_FPGA/Tutorials/GettingStarted/fpga_compile/part2_dpcpp_functor_usm

https://github.com/oneapi-src/oneAPI-samples/tree/master/DirectProgramming/C%2B%2BSYCL_FPGA/Tutorials/GettingStarted/fpga_compile/part3_dpcpp_lambda_usm

the code allocate shared buffers

part2_dpcpp_functor_usm/src/vector_add.cpp:58:    // allocate in shared memory so the kernel can see them
part2_dpcpp_functor_usm/src/vector_add.cpp:59:    int *vec_a = sycl::malloc_shared<int>(kVectSize, q);
part2_dpcpp_functor_usm/src/vector_add.cpp:60:    int *vec_b = sycl::malloc_shared<int>(kVectSize, q);
part2_dpcpp_functor_usm/src/vector_add.cpp:61:    int *vec_c = sycl::malloc_shared<int>(kVectSize, q);

code seems to get stuck when executing

https://github.com/oneapi-src/oneAPI-samples/blob/d9ea61ab122ab030fbd74362bf9cd68766556117/DirectProgramming/C%2B%2BSYCL_FPGA/Tutorials/GettingStarted/fpga_compile/part2_dpcpp_functor_usm/src/vector_add.cpp#L69

and

https://github.com/oneapi-src/oneAPI-samples/blob/d9ea61ab122ab030fbd74362bf9cd68766556117/DirectProgramming/C%2B%2BSYCL_FPGA/Tutorials/GettingStarted/fpga_compile/part3_dpcpp_lambda_usm/src/vector_add.cpp#L63

i am using OFS 2024.1-1 and repo tags mentioned here https://github.com/orgs/OFS/discussions/60

https://github.com/oneapi-src/oneAPI-samples (tag 2024.1.0)

$ quartus_sh --version Quartus Prime Shell Version 23.4.0 Build 79 11/22/2023 Patches 0.02iofs,0.17 SC Pro Edition Copyright (C) 2023 Intel Corporation. All rights reserved.

$ icpx --version Intel(R) oneAPI DPC++/C++ Compiler 2024.0.2 (2024.0.2.20231213) Target: x86_64-unknown-linux-gnu Thread model: posix InstalledDir: /opt/intel/oneapi/compiler/2024.0/bin/compiler Configuration file: /opt/intel/oneapi/compiler/2024.0/bin/compiler/../icpx.cfg

aktole commented 3 months ago

Hi,

oneAPI code samples repository tag must match the oneAPI Compiler version you are using (2024.0 from your icpx --version output). Can you try with the correct code sample repository tag (i.e. 2024.0 for oneAPI compiler version 2024.0.x)? If you would like to use the latest oneAPI compiler and code samples tag (i.e. 2024.1), please download the latest Intel® oneAPI Base Toolkit version 2024.1 from here. Let us know if you continue seeing this issue with the matching compiler and code sample repository tag.

Thanks

umairsiddiqui-digitek commented 3 months ago

i resynthesize the tutorial with https://github.com/oneapi-src/oneAPI-samples/releases/tag/2024.0.0

but i am getting same results. the application hangs after

add two vectors of size 256

i also filed https://github.com/OFS/oneapi-asp/issues/141

but this is a small example so (most likely) memory shouldn't be problem.


i added following statements to get USM info:

    std::cout << "usm_device_allocations:" <<  device.get_info<sycl::info::device::usm_device_allocations>() << std::endl;
    std::cout << "usm_host_allocations:" <<  device.get_info<sycl::info::device::usm_host_allocations>() << std::endl  ;
    std::cout << "usm_shared_allocations:" <<  device.get_info<sycl::info::device::usm_shared_allocations>() << std::endl;
    std::cout << "usm_restricted_shared_allocations:" <<  device.get_info<sycl::info::device::usm_restricted_shared_allocations>() << std::endl;
    std::cout << "usm_system_allocations:" <<  device.get_info<sycl::info::device::usm_system_allocations>() << std::endl ;

then i got

usm_device_allocations:1
usm_host_allocations:1
usm_shared_allocations:1
usm_restricted_shared_allocations:1
usm_system_allocations:0

does usm_restricted_shared_allocations means runtime/oneAPI-asp MMD can not automatically migrate shared buffer (allocated from sycl::malloc_shared) from host <-> device?

mfmendoz-Intel commented 2 months ago

Hi, sorry for the delay with response, we were able to reproduce this issue, we are looking at this internally and will get back to you.

Thanks