From de9817dd156ca443e2ba8511cbdbbcf1414f26a9 Mon Sep 17 00:00:00 2001 From: Roger Barton Date: Tue, 16 Jan 2024 17:19:38 +0100 Subject: [PATCH] roi spec added --- target/sim/bench.ipynb | 278 ++++++++++++++++++++++++++++++++++------- target/sim/spec.json | 21 ++++ 2 files changed, 252 insertions(+), 47 deletions(-) create mode 100644 target/sim/spec.json diff --git a/target/sim/bench.ipynb b/target/sim/bench.ipynb index 0bfbb20ff..da74d8cd0 100644 --- a/target/sim/bench.ipynb +++ b/target/sim/bench.ipynb @@ -12,7 +12,11 @@ "cell_type": "code", "execution_count": null, "id": "c018cdf4-4eac-434f-ab48-c86c9ee61541", - "metadata": {}, + "metadata": { + "vscode": { + "languageId": "python" + } + }, "outputs": [], "source": [ "!python -m pip install pandas plotly pyyaml" @@ -22,7 +26,11 @@ "cell_type": "code", "execution_count": null, "id": "263c1118-51c5-4a82-9226-b01df47c40a7", - "metadata": {}, + "metadata": { + "vscode": { + "languageId": "python" + } + }, "outputs": [], "source": [ "import pandas as pd, numpy as np\n", @@ -95,7 +103,11 @@ "cell_type": "code", "execution_count": null, "id": "aff8e0ac-8b91-4ac1-b9f1-5da08ff143e1", - "metadata": {}, + "metadata": { + "vscode": { + "languageId": "python" + } + }, "outputs": [], "source": [ "# Compile hardware for Questa (vsim)\n", @@ -106,7 +118,11 @@ "cell_type": "code", "execution_count": null, "id": "16e62def-f903-455e-994a-6661c8b8895d", - "metadata": {}, + "metadata": { + "vscode": { + "languageId": "python" + } + }, "outputs": [], "source": [ "# Compile software\n", @@ -117,7 +133,11 @@ "cell_type": "code", "execution_count": null, "id": "ef1ab542-924c-4c02-a507-6044c4b32169", - "metadata": {}, + "metadata": { + "vscode": { + "languageId": "python" + } + }, "outputs": [], "source": [ "# Post process traces\n", @@ -129,7 +149,11 @@ "cell_type": "code", "execution_count": null, "id": "3caceab4-f9cd-474a-9ce2-8688d05317d8", - "metadata": {}, + "metadata": { + "vscode": { + "languageId": "python" + } + }, "outputs": [], "source": [ "# Read profile data\n", @@ -141,7 +165,11 @@ "cell_type": "code", "execution_count": null, "id": "d20fe0e3-3f04-4a05-ab11-3d016dc75e79", - "metadata": {}, + "metadata": { + "vscode": { + "languageId": "python" + } + }, "outputs": [], "source": [ "# Plot some results\n", @@ -153,7 +181,11 @@ "cell_type": "code", "execution_count": null, "id": "28811c2e-63ee-4143-ad82-4d97420b9b68", - "metadata": {}, + "metadata": { + "vscode": { + "languageId": "python" + } + }, "outputs": [], "source": [ "!make CFG_OVERRIDE={cfg_file} rtl" @@ -171,7 +203,11 @@ "cell_type": "code", "execution_count": null, "id": "96393e95-7390-4157-9314-af5155f46f22", - "metadata": {}, + "metadata": { + "vscode": { + "languageId": "python" + } + }, "outputs": [], "source": [ "# Load top-level benchmark config, where all sweep information is stored\n", @@ -185,7 +221,11 @@ "cell_type": "code", "execution_count": null, "id": "a537b79f-0d5d-48d3-8662-bd6db2ef05ab", - "metadata": {}, + "metadata": { + "vscode": { + "languageId": "python" + } + }, "outputs": [], "source": [ "# flatten into a table\n", @@ -198,7 +238,11 @@ "cell_type": "code", "execution_count": null, "id": "f68f9aea-c801-4c1b-a1ab-2c70fc782aa8", - "metadata": {}, + "metadata": { + "vscode": { + "languageId": "python" + } + }, "outputs": [], "source": [ "# Evaluate expressions, any property ending in .eval is executed\n", @@ -216,7 +260,11 @@ "cell_type": "code", "execution_count": null, "id": "cb40f6f7-4cc5-495d-925b-86c41d31df15", - "metadata": {}, + "metadata": { + "vscode": { + "languageId": "python" + } + }, "outputs": [], "source": [ "# Explode sweep arrays to get all combinations to run\n", @@ -234,7 +282,11 @@ "cell_type": "code", "execution_count": null, "id": "24765e2c-d71b-4af5-a6b0-d0ef2de1377a", - "metadata": {}, + "metadata": { + "vscode": { + "languageId": "python" + } + }, "outputs": [], "source": [] }, @@ -242,7 +294,11 @@ "cell_type": "code", "execution_count": null, "id": "bac025c0-3270-4823-8204-418e31e22652", - "metadata": {}, + "metadata": { + "vscode": { + "languageId": "python" + } + }, "outputs": [], "source": [ "def compile_hw(config: str):\n", @@ -271,7 +327,11 @@ "cell_type": "code", "execution_count": null, "id": "09539ef4-0b02-4253-a095-26611601820a", - "metadata": {}, + "metadata": { + "vscode": { + "languageId": "python" + } + }, "outputs": [], "source": [ "# Setup output directory \n", @@ -316,7 +376,11 @@ "cell_type": "code", "execution_count": null, "id": "3213017b-a0ff-4e47-80f4-fa029cda2a4e", - "metadata": {}, + "metadata": { + "vscode": { + "languageId": "python" + } + }, "outputs": [], "source": [ "configs.groupby(by='hw.config').get_group('full')" @@ -326,7 +390,11 @@ "cell_type": "code", "execution_count": null, "id": "3a08c9b6-82de-4e36-a4bc-90fca987b151", - "metadata": {}, + "metadata": { + "vscode": { + "languageId": "python" + } + }, "outputs": [], "source": [] }, @@ -334,7 +402,11 @@ "cell_type": "code", "execution_count": null, "id": "813a82e1-5683-497a-8603-545cb55baada", - "metadata": {}, + "metadata": { + "vscode": { + "languageId": "python" + } + }, "outputs": [], "source": [] }, @@ -342,7 +414,11 @@ "cell_type": "code", "execution_count": null, "id": "46335c5f-0802-4541-8ebe-5f3ef2de12e4", - "metadata": {}, + "metadata": { + "vscode": { + "languageId": "python" + } + }, "outputs": [], "source": [] }, @@ -358,7 +434,11 @@ "cell_type": "code", "execution_count": null, "id": "002be39d-43cf-4b35-b939-b3e66f7965fb", - "metadata": {}, + "metadata": { + "vscode": { + "languageId": "python" + } + }, "outputs": [], "source": [ "args = {}\n", @@ -373,7 +453,11 @@ "cell_type": "code", "execution_count": null, "id": "62cd158c-0494-444b-bc86-de08c0681e6e", - "metadata": {}, + "metadata": { + "vscode": { + "languageId": "python" + } + }, "outputs": [], "source": [ "import sys\n", @@ -394,7 +478,11 @@ "cell_type": "code", "execution_count": null, "id": "347b27bc-bba7-41d5-9e8a-bb7e57a44d88", - "metadata": {}, + "metadata": { + "vscode": { + "languageId": "python" + } + }, "outputs": [], "source": [ "!make CFG_OVERRIDE={args['hw_config']} DEBUG=ON sw" @@ -405,7 +493,10 @@ "execution_count": null, "id": "91c3a858-8e0c-448b-8ecf-fa8583bb1317", "metadata": { - "scrolled": true + "scrolled": true, + "vscode": { + "languageId": "python" + } }, "outputs": [], "source": [ @@ -422,7 +513,11 @@ "cell_type": "code", "execution_count": null, "id": "ab065250-6faf-41ff-9a69-1633e6abc948", - "metadata": {}, + "metadata": { + "vscode": { + "languageId": "python" + } + }, "outputs": [], "source": [ "# Extract input operands from ELF file\n", @@ -477,7 +572,10 @@ "execution_count": null, "id": "d181eb78-2dc7-4f0a-a0d4-6f67e70da99d", "metadata": { - "scrolled": true + "scrolled": true, + "vscode": { + "languageId": "python" + } }, "outputs": [], "source": [ @@ -488,7 +586,11 @@ "cell_type": "code", "execution_count": null, "id": "3a5a2483-3454-4d5a-9a40-0a0e5984f932", - "metadata": {}, + "metadata": { + "vscode": { + "languageId": "python" + } + }, "outputs": [], "source": [ "c_actual" @@ -498,7 +600,11 @@ "cell_type": "code", "execution_count": null, "id": "3d9e8972-1c93-4715-8996-89b04bdb664d", - "metadata": {}, + "metadata": { + "vscode": { + "languageId": "python" + } + }, "outputs": [], "source": [ "result" @@ -509,13 +615,31 @@ "execution_count": null, "id": "bfb3f426-7610-4901-9af6-d0487d173046", "metadata": { - "scrolled": true + "scrolled": true, + "vscode": { + "languageId": "python" + } }, "outputs": [], "source": [ "!make -j annotate BINARY=sw/device/apps/blas/gemm/build/gemm.elf" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "39f5e03e-a92e-491a-b683-11f0f1efe335", + "metadata": { + "scrolled": true, + "vscode": { + "languageId": "python" + } + }, + "outputs": [], + "source": [ + "!make -j ROI_SPEC=spec.json logs/trace.json" + ] + }, { "cell_type": "markdown", "id": "925ac4a8-de21-4203-b52a-185aaa3c212c", @@ -529,7 +653,11 @@ "cell_type": "code", "execution_count": null, "id": "c70c0672-e284-4239-bfaa-ff9d33d046c5", - "metadata": {}, + "metadata": { + "vscode": { + "languageId": "python" + } + }, "outputs": [], "source": [ "# Works for PI == PJ\n", @@ -544,7 +672,11 @@ "cell_type": "code", "execution_count": null, "id": "23383d54-a8f8-4052-8485-8e4685f78178", - "metadata": {}, + "metadata": { + "vscode": { + "languageId": "python" + } + }, "outputs": [], "source": [ "pi = (p / PJ).astype(int)\n", @@ -555,7 +687,11 @@ "cell_type": "code", "execution_count": null, "id": "b13d577c-38dc-4822-b8ec-9e3456810ebd", - "metadata": {}, + "metadata": { + "vscode": { + "languageId": "python" + } + }, "outputs": [], "source": [ "pj = (p % PJ).astype(int)\n", @@ -566,7 +702,11 @@ "cell_type": "code", "execution_count": null, "id": "dd6da9ba-0a27-43f8-89b0-78ab50e247c1", - "metadata": {}, + "metadata": { + "vscode": { + "languageId": "python" + } + }, "outputs": [], "source": [ "pk = (2*PJ - pi - pj -1) % PJ # Or if k flipped: (PJ -pi + pj) % PJ\n", @@ -577,7 +717,11 @@ "cell_type": "code", "execution_count": null, "id": "fa8d23d0-bcd7-457c-ad8d-9bfb48fd1a5a", - "metadata": {}, + "metadata": { + "vscode": { + "languageId": "python" + } + }, "outputs": [], "source": [ "srca = pi * PJ + ((2*PJ - pi - pk) % PJ)\n", @@ -588,7 +732,11 @@ "cell_type": "code", "execution_count": null, "id": "1783c7cb-f71f-4fbc-982e-a9ca6d5b839e", - "metadata": {}, + "metadata": { + "vscode": { + "languageId": "python" + } + }, "outputs": [], "source": [ "srcb = pj + PJ * ((2*PJ - pj - pk) % PJ)\n", @@ -599,7 +747,11 @@ "cell_type": "code", "execution_count": null, "id": "9b2c7dfb-718a-49ae-a737-bf135b24169b", - "metadata": {}, + "metadata": { + "vscode": { + "languageId": "python" + } + }, "outputs": [], "source": [ "sa = pi * PJ + ((PJ - pi - pj) % PJ)\n", @@ -610,7 +762,11 @@ "cell_type": "code", "execution_count": null, "id": "777ceb79-d417-4995-a5d3-f0fd2af26573", - "metadata": {}, + "metadata": { + "vscode": { + "languageId": "python" + } + }, "outputs": [], "source": [ "sb = pi + PJ *((PJ - pi + pj) % PJ)\n", @@ -621,7 +777,11 @@ "cell_type": "code", "execution_count": null, "id": "be14971f-8d22-43d6-b154-9d05af168f40", - "metadata": {}, + "metadata": { + "vscode": { + "languageId": "python" + } + }, "outputs": [], "source": [ "PJ * ((PJ - pi + pj) % PJ)" @@ -631,7 +791,11 @@ "cell_type": "code", "execution_count": null, "id": "50c615ee-810f-40c7-a1ff-830b380ef1a7", - "metadata": {}, + "metadata": { + "vscode": { + "languageId": "python" + } + }, "outputs": [], "source": [ "dram = ((p+1) % PJ == 0)\n", @@ -642,7 +806,11 @@ "cell_type": "code", "execution_count": null, "id": "e8a89535-a92a-4f41-893f-a51f29244735", - "metadata": {}, + "metadata": { + "vscode": { + "languageId": "python" + } + }, "outputs": [], "source": [ "sa = sa * (1-dram) + dram * -1\n", @@ -653,7 +821,11 @@ "cell_type": "code", "execution_count": null, "id": "7895d159-de0e-4d47-9e38-c03bdd42d2d4", - "metadata": {}, + "metadata": { + "vscode": { + "languageId": "python" + } + }, "outputs": [], "source": [ "sb = sb * (1-dram) + dram * -1\n", @@ -664,7 +836,11 @@ "cell_type": "code", "execution_count": null, "id": "dd23dac9-1184-47b6-93e8-5ce0e453f365", - "metadata": {}, + "metadata": { + "vscode": { + "languageId": "python" + } + }, "outputs": [], "source": [ "pipeStep = (PJ - p - 1) % PJ\n", @@ -675,7 +851,11 @@ "cell_type": "code", "execution_count": null, "id": "8c098e3b-84b5-4f70-aa81-bf2c1df02f08", - "metadata": {}, + "metadata": { + "vscode": { + "languageId": "python" + } + }, "outputs": [], "source": [] }, @@ -683,16 +863,20 @@ "cell_type": "code", "execution_count": null, "id": "22443e7d-45b1-41fd-9f7c-88b85f3949fe", - "metadata": {}, + "metadata": { + "vscode": { + "languageId": "python" + } + }, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { - "display_name": "Python 3 (ipykernel)", - "language": "python", - "name": "python3" + "display_name": "Octave", + "language": "octave", + "name": "octave" }, "language_info": { "codemirror_mode": { @@ -701,7 +885,7 @@ }, "file_extension": ".py", "mimetype": "text/x-python", - "name": "python", + "name": "octave", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.9.12" diff --git a/target/sim/spec.json b/target/sim/spec.json new file mode 100644 index 000000000..b0f5ae619 --- /dev/null +++ b/target/sim/spec.json @@ -0,0 +1,21 @@ +[ +% for i in range(0, cfg['nr_s1_quadrant']*cfg['s1_quadrant']['nr_clusters']): +% for j in range(0, 8): + { + "thread": "${f'hart_{9*i+j +1}'}", + "roi": [ + {"idx": 1, "label": "compute"} + ] + }, +% endfor + { + "thread": "${f'dma_{9*(i+1)}'}", + "roi": [ + {"idx": 0, "label": "dma_in"}, +% for dma_i in range(0, 8): + {"idx": ${dma_i + 12}, "label": "dma_tile"}, +% endfor + ] + }, +% endfor +]