計算ユニット名を使用して非対称計算ユニットすべてのハンドルを取得 - 2020.1 Japanese

Vitis 統合ソフトウェア プラットフォームの資料: アプリケーション アクセラレーション開発 (UG1393)

Document ID
UG1393
Release Date
2020-08-20
Version
2020.1 Japanese

カーネルが複数の対称ではない CU をインスタンシエートすると、clCreateKernel コマンドに CU 名を指定して、異なる CU グループを作成します。この場合、ホスト プログラムは clCreateKernel で返される cl_kernel ハンドルを使用して特定の CU グループを参照できます。

次の例では、mykernel カーネルに 5 つの CU (K1、K2、K3、K4、K5) が含まれます。K1、K2、および K3 CU は、デバイス上に対称接続を持つ 1 つの対称グループです。同様に、K4 および K5 計算ユニットは 2 つ目の対称 CU のグループです。次のコード セグメントに、cl_kernel ハンドルを使用した特定の CU グループの指定を示します。

// Kernel handle for Symmetrical compute unit group 1: K1,K2,K3
cl_kernel kernelA = clCreateKernel(program,"mykernel:{K1,K2,K3}",&err);

for(i=0; i<3; i++) {
  // Creating buffers for the kernel_handle1
  .....
  // Setting kernel arguments for kernel_handle1
  .....
  // Enqueue buffers for the kernel_handle1
  .....
  // Possible candidates of the executions K1,K2 or K3
  clEnqueueTask(commands, kernelA, 0, NULL, NULL); 
  //
}

// Kernel handle for Symmetrical compute unit group 1: K4, K5
cl_kernel kernelB = clCreateKernel(program,"mykernel:{K4,K5}",&err);

for(int i=0; i<2; i++) {
  // Creating buffers for the kernel_handle2
  .....
  // Setting kernel arguments for kernel_handle2
  .....
  // Enqueue buffers for the kernel_handle2
  .....
  // Possible candidates of the executions K4 or K5
  clEnqueueTask(commands, kernelB, 0, NULL, NULL);
}