From: "Zeng, Oak" <Oak.Zeng-5C7GfCeVMHo@public.gmane.org>
To: "amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org"
<amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>
Cc: "Kuehling, Felix" <Felix.Kuehling-5C7GfCeVMHo@public.gmane.org>,
"Zeng, Oak" <Oak.Zeng-5C7GfCeVMHo@public.gmane.org>,
"Keely, Sean" <Sean.Keely-5C7GfCeVMHo@public.gmane.org>
Subject: [PATCH 3/7] drm/amdkfd: Allocate gws on device initialization
Date: Wed, 22 May 2019 15:51:29 +0000 [thread overview]
Message-ID: <1558540278-23734-3-git-send-email-Oak.Zeng@amd.com> (raw)
In-Reply-To: <1558540278-23734-1-git-send-email-Oak.Zeng-5C7GfCeVMHo@public.gmane.org>
On device initialization, KFD allocates all (64) gws which
is shared by all KFD processes.
Change-Id: I1f1274b8d4f6a8ad08785e2791a9a79def75e913
Signed-off-by: Oak Zeng <Oak.Zeng@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
---
drivers/gpu/drm/amd/amdkfd/kfd_device.c | 14 +++++++++++++-
drivers/gpu/drm/amd/amdkfd/kfd_priv.h | 3 +++
2 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device.c b/drivers/gpu/drm/amd/amdkfd/kfd_device.c
index 7b4ea24..9d1b026 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_device.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_device.c
@@ -553,6 +553,13 @@ bool kgd2kfd_device_init(struct kfd_dev *kfd,
} else
kfd->max_proc_per_quantum = hws_max_conc_proc;
+ /* Allocate global GWS that is shared by all KFD processes */
+ if (hws_gws_support && amdgpu_amdkfd_alloc_gws(kfd->kgd,
+ amdgpu_amdkfd_get_num_gws(kfd->kgd), &kfd->gws)) {
+ dev_err(kfd_device, "Could not allocate %d gws\n",
+ amdgpu_amdkfd_get_num_gws(kfd->kgd));
+ goto out;
+ }
/* calculate max size of mqds needed for queues */
size = max_num_of_queues_per_device *
kfd->device_info->mqd_size_aligned;
@@ -576,7 +583,7 @@ bool kgd2kfd_device_init(struct kfd_dev *kfd,
&kfd->gtt_start_gpu_addr, &kfd->gtt_start_cpu_ptr,
false)) {
dev_err(kfd_device, "Could not allocate %d bytes\n", size);
- goto out;
+ goto alloc_gtt_mem_failure;
}
dev_info(kfd_device, "Allocated %d bytes on gart\n", size);
@@ -646,6 +653,9 @@ bool kgd2kfd_device_init(struct kfd_dev *kfd,
kfd_gtt_sa_fini(kfd);
kfd_gtt_sa_init_error:
amdgpu_amdkfd_free_gtt_mem(kfd->kgd, kfd->gtt_mem);
+alloc_gtt_mem_failure:
+ if (hws_gws_support)
+ amdgpu_amdkfd_free_gws(kfd->kgd, kfd->gws);
dev_err(kfd_device,
"device %x:%x NOT added due to errors\n",
kfd->pdev->vendor, kfd->pdev->device);
@@ -663,6 +673,8 @@ void kgd2kfd_device_exit(struct kfd_dev *kfd)
kfd_doorbell_fini(kfd);
kfd_gtt_sa_fini(kfd);
amdgpu_amdkfd_free_gtt_mem(kfd->kgd, kfd->gtt_mem);
+ if (hws_gws_support)
+ amdgpu_amdkfd_free_gws(kfd->kgd, kfd->gws);
}
kfree(kfd);
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h
index 338fb07..5969e37 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h
@@ -288,6 +288,9 @@ struct kfd_dev {
/* Compute Profile ref. count */
atomic_t compute_profile;
+
+ /* Global GWS resource shared b/t processes*/
+ void *gws;
};
enum kfd_mempool {
--
2.7.4
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
next prev parent reply other threads:[~2019-05-22 15:51 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-22 15:51 [PATCH 1/7] drm/amdkfd: Add gws number to kfd topology node properties Zeng, Oak
[not found] ` <1558540278-23734-1-git-send-email-Oak.Zeng-5C7GfCeVMHo@public.gmane.org>
2019-05-22 15:51 ` [PATCH 2/7] drm/amdgpu: Add interface to alloc gws from amdgpu Zeng, Oak
2019-05-22 15:51 ` Zeng, Oak [this message]
2019-05-22 15:51 ` [PATCH 4/7] drm/amdgpu: Add function to add/remove gws to kfd process Zeng, Oak
[not found] ` <1558540278-23734-4-git-send-email-Oak.Zeng-5C7GfCeVMHo@public.gmane.org>
2019-05-22 21:49 ` Kuehling, Felix
2019-05-22 15:51 ` [PATCH 5/7] drm/amdkfd: Add function to set queue gws Zeng, Oak
[not found] ` <1558540278-23734-5-git-send-email-Oak.Zeng-5C7GfCeVMHo@public.gmane.org>
2019-05-22 21:46 ` Kuehling, Felix
2019-05-22 15:51 ` [PATCH 6/7] drm/amdkfd: New IOCTL to allocate queue GWS Zeng, Oak
[not found] ` <1558540278-23734-6-git-send-email-Oak.Zeng-5C7GfCeVMHo@public.gmane.org>
2019-05-22 21:49 ` Kuehling, Felix
2019-05-22 15:51 ` [PATCH 7/7] drm/amdkfd: PM4 packets change to support GWS Zeng, Oak
-- strict thread matches above, loose matches on Subject: below --
2019-05-23 18:40 [PATCH 1/7] drm/amdkfd: Add gws number to kfd topology node properties Zeng, Oak
[not found] ` <1558636843-9867-1-git-send-email-Oak.Zeng-5C7GfCeVMHo@public.gmane.org>
2019-05-23 18:41 ` [PATCH 3/7] drm/amdkfd: Allocate gws on device initialization Zeng, Oak
2019-05-15 20:37 [PATCH 1/7] drm/amdkfd: Add gws number to kfd topology node properties Zeng, Oak
[not found] ` <1557952664-12218-1-git-send-email-Oak.Zeng-5C7GfCeVMHo@public.gmane.org>
2019-05-15 20:37 ` [PATCH 3/7] drm/amdkfd: Allocate gws on device initialization Zeng, Oak
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1558540278-23734-3-git-send-email-Oak.Zeng@amd.com \
--to=oak.zeng-5c7gfcevmho@public.gmane.org \
--cc=Felix.Kuehling-5C7GfCeVMHo@public.gmane.org \
--cc=Sean.Keely-5C7GfCeVMHo@public.gmane.org \
--cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox