Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: add doc to show how to use NICE/VNICE for acceleration when usin… #38

Merged
merged 7 commits into from
Aug 30, 2024

Conversation

xzt777
Copy link
Contributor

@xzt777 xzt777 commented Aug 26, 2024

此文档展示了如何使用Nuclei Model进行NICE/VNICE的指令加速,然后通过Nuclei Studio的Profiling功能分析加速前后程序性能。

@xzt777 xzt777 added the documentation Improvements or additions to documentation label Aug 26, 2024
@xzt777 xzt777 requested a review from fanghuaqi August 26, 2024 04:04
@xzt777 xzt777 self-assigned this Aug 26, 2024
Copy link
Member

@fanghuaqi fanghuaqi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

请修改

@@ -0,0 +1,279 @@
# 通过Profiling展示Nuclei Model NICE/VNICE指令加速

> 由于 Nuclei Model 仅支持Linux版本,所以此文档的测试都是基于 Nuclei Studio 的 Linux版本完成的。
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

版本号加进去, >= 2024.06


#### step6:在 Nuclei Model 中实现 NICE/VNICE 指令

此部分不是本文档的重点,用户可以通过 Nuclei Studio 中的 NICE Wizard 配置完成 **NICE/VNICE** 指令的实现模板生成,并在其中实现自己的自定义指令和指令 cycle 的添加。
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里就是你的重点怎么一下子就忽略了,且没有NICE Wizard这个功能。

你需要指导用户怎么去在 Model里面实现 这个自定义的NICE指令。

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NICE指令消耗的时间不能只是一个Cycle,这里你要写清楚举例的时间。


用户通过定义 Vector 寄存器以及使用上定义好的 VNICE 指令内嵌汇编如下:

~~~
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

加上c的标签 ~~~c, 其余类似


#### step7:热点函数再分析

重新编译程序代码,然后重新 run RVProf 运行 Nuclei Model,双击 `gprof0.gmon` 可以看到CPU占用率较高的热点函数已经没有 `aes_mix_columns_enc` 和 `aes_mix_columns_dec` 了:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里 run rvprof里面是否有配置需要勾选去掉。消耗时间怎么配置需要讲一下。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

消耗时间指的是model跑程序timeout时间吗

@xzt777
Copy link
Contributor Author

xzt777 commented Aug 29, 2024

文档已经整体更新,重要部分是加入了 step6:在 Nuclei Model 中实现 NICE/VNICE 指令

@xzt777
Copy link
Contributor Author

xzt777 commented Aug 30, 2024

文档已经整体更新,重要部分是添加model如何使用NICE load/store mem,寄存器说明,以及告诉用户备份 aes_demo 为 aes_demo_nice,重新配置 RVProf以及添加新的model执行路径,再就是两个工程的profiling对比图示。

Copy link
Member

@fanghuaqi fanghuaqi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@fanghuaqi fanghuaqi merged commit 978b79d into Nuclei-Software:main Aug 30, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants