diff --git a/src/kernelbot/cogs/leaderboard_cog.py b/src/kernelbot/cogs/leaderboard_cog.py index 84dbcc5b..034642a0 100644 --- a/src/kernelbot/cogs/leaderboard_cog.py +++ b/src/kernelbot/cogs/leaderboard_cog.py @@ -223,14 +223,14 @@ async def lang_autocomplete( bot = interaction.client with bot.leaderboard_db as db: - leaderboard_item = db.get_leaderboard(lb) # type: LeaderboardItem + templates = db.get_leaderboard_templates(lb) - candidates = leaderboard_item["task"].templates + candidates = list(templates.keys()) return [discord.app_commands.Choice(name=c, value=c) for c in candidates] def add_header_to_template(lang: str, code: str, lb: LeaderboardItem): - comment_char = {"CUDA": "//", "Python": "#", "Triton": "#", "HIP": "#"}[lang] + comment_char = {"CUDA": "//", "Python": "#", "Triton": "#", "HIP": "#", "CuteDSL": "#"}[lang] description_comment = [f"{comment_char} > {line}" for line in lb["description"].splitlines()] header = f""" @@ -539,7 +539,7 @@ async def get_task_template( return template = add_header_to_template(lang, templates[lang], leaderboard_item) - ext = {"CUDA": "cu", "Python": "py", "Triton": "py", "HIP": "py"} + ext = {"CUDA": "cu", "Python": "py", "Triton": "py", "HIP": "py", "CuteDSL": "py"} file_name = f"{leaderboard_name}.{ext[lang]}" file = discord.File(fp=StringIO(template), filename=file_name) message = f"**Starter code for leaderboard `{leaderboard_name}`**\n" diff --git a/src/libkernelbot/task.py b/src/libkernelbot/task.py index 04ae944d..e743e6b9 100644 --- a/src/libkernelbot/task.py +++ b/src/libkernelbot/task.py @@ -144,7 +144,7 @@ def make_task_definition(yaml_file: str | Path) -> LeaderboardDefinition: # noq # load template files templates = {} for lang, source in raw.get("templates", {}).items(): - assert lang in ["CUDA", "Python", "Triton", "HIP"] + assert lang in ["CUDA", "Python", "Triton", "HIP", "CuteDSL"] templates[lang] = (root / source).read_text() if templates: