v4.3 update. (#2709)
* v4.3 update. * Update the cute_dsl_api changelog's doc link * Update version to 4.3.0 * Update the example link * Update doc to encourage user to install DSL from requirements.txt --------- Co-authored-by: Larry Wu <larwu@nvidia.com>
This commit is contained in:
@@ -83,8 +83,8 @@
|
||||
" print(\">>>\", type(b)) # => <class 'int'>\n",
|
||||
"\n",
|
||||
" layout = cute.make_layout((a, b))\n",
|
||||
" print(\">>>\", layout) # => (?,2):(1,?)\n",
|
||||
" cute.printf(\">?? {}\", layout) # => (8,2):(1,8)"
|
||||
" print(\">>>\", layout) # => (?,2):(1,?)\n",
|
||||
" cute.printf(\">?? {}\", layout) # => (8,2):(1,8)"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -221,6 +221,7 @@
|
||||
" layout = cute.make_layout((a, b))\n",
|
||||
" print(f\"layout: {layout}\")\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"print(\"Direct run output:\")\n",
|
||||
"format_string_example(cutlass.Int32(8), 2)"
|
||||
]
|
||||
@@ -246,23 +247,26 @@
|
||||
"source": [
|
||||
"from cutlass.cute.runtime import from_dlpack\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"@cute.jit\n",
|
||||
"def print_tensor_basic(x : cute.Tensor):\n",
|
||||
"def print_tensor_basic(x: cute.Tensor):\n",
|
||||
" # Print the tensor\n",
|
||||
" print(\"Basic output:\")\n",
|
||||
" cute.print_tensor(x)\n",
|
||||
" \n",
|
||||
"\n",
|
||||
"\n",
|
||||
"@cute.jit\n",
|
||||
"def print_tensor_verbose(x : cute.Tensor):\n",
|
||||
"def print_tensor_verbose(x: cute.Tensor):\n",
|
||||
" # Print the tensor with verbose mode\n",
|
||||
" print(\"Verbose output:\")\n",
|
||||
" cute.print_tensor(x, verbose=True)\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"@cute.jit\n",
|
||||
"def print_tensor_slice(x : cute.Tensor, coord : tuple):\n",
|
||||
"def print_tensor_slice(x: cute.Tensor, coord: tuple):\n",
|
||||
" # slice a 2D tensor from the 3D tensor\n",
|
||||
" sliced_data = cute.slice_(x, coord)\n",
|
||||
" y = cute.make_fragment(sliced_data.layout, sliced_data.element_type)\n",
|
||||
" y = cute.make_rmem_tensor(sliced_data.layout, sliced_data.element_type)\n",
|
||||
" # Convert to TensorSSA format by loading the sliced data into the fragment\n",
|
||||
" y.store(sliced_data.load())\n",
|
||||
" print(\"Slice output:\")\n",
|
||||
@@ -302,12 +306,13 @@
|
||||
"source": [
|
||||
"def tensor_print_example1():\n",
|
||||
" shape = (4, 3, 2)\n",
|
||||
" \n",
|
||||
"\n",
|
||||
" # Creates [0,...,23] and reshape to (4, 3, 2)\n",
|
||||
" data = np.arange(24, dtype=np.float32).reshape(*shape) \n",
|
||||
" \n",
|
||||
" data = np.arange(24, dtype=np.float32).reshape(*shape)\n",
|
||||
"\n",
|
||||
" print_tensor_basic(from_dlpack(data))\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"tensor_print_example1()"
|
||||
]
|
||||
},
|
||||
@@ -348,12 +353,13 @@
|
||||
"source": [
|
||||
"def tensor_print_example2():\n",
|
||||
" shape = (4, 3)\n",
|
||||
" \n",
|
||||
"\n",
|
||||
" # Creates [0,...,11] and reshape to (4, 3)\n",
|
||||
" data = np.arange(12, dtype=np.float32).reshape(*shape) \n",
|
||||
" \n",
|
||||
" data = np.arange(12, dtype=np.float32).reshape(*shape)\n",
|
||||
"\n",
|
||||
" print_tensor_verbose(from_dlpack(data))\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"tensor_print_example2()"
|
||||
]
|
||||
},
|
||||
@@ -390,13 +396,14 @@
|
||||
"source": [
|
||||
"def tensor_print_example3():\n",
|
||||
" shape = (4, 3)\n",
|
||||
" \n",
|
||||
"\n",
|
||||
" # Creates [0,...,11] and reshape to (4, 3)\n",
|
||||
" data = np.arange(12, dtype=np.float32).reshape(*shape) \n",
|
||||
" \n",
|
||||
" data = np.arange(12, dtype=np.float32).reshape(*shape)\n",
|
||||
"\n",
|
||||
" print_tensor_slice(from_dlpack(data), (None, 0))\n",
|
||||
" print_tensor_slice(from_dlpack(data), (1, None))\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"tensor_print_example3()"
|
||||
]
|
||||
},
|
||||
@@ -418,9 +425,10 @@
|
||||
" print(src)\n",
|
||||
" cute.print_tensor(src)\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"@cute.jit\n",
|
||||
"def print_tensor_host(src: cute.Tensor):\n",
|
||||
" print_tensor_gpu(src).launch(grid=(1,1,1), block=(1,1,1))"
|
||||
" print_tensor_gpu(src).launch(grid=(1, 1, 1), block=(1, 1, 1))"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -449,11 +457,14 @@
|
||||
],
|
||||
"source": [
|
||||
"import torch\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"def tensor_print_example4():\n",
|
||||
" a = torch.randn(4, 3, device=\"cuda\")\n",
|
||||
" cutlass.cuda.initialize_cuda_context()\n",
|
||||
" print_tensor_host(from_dlpack(a))\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"tensor_print_example4()"
|
||||
]
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user