Skip to contentSkip to conversation

Revert "drm/amdgpu: add dep_sync for amdgpu job"

PATCH NAK Andrey Grodzovsky 2 participants 2 messages Nov 3, 2017 – Nov 13, 2017 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Revert "drm/amdgpu: add dep_sync for amdgpu job"

This reverts commit a340c7bcf1ea01f8bee82d62b521f0c5e4653425.

This is a cleanp of dep_sync in amdgpu_job. The origianl patch never calls amdgpu_sync_fence on dep_sync, only amdgpu_sync_get_fence in amdgpu_job_dependency, so dep_sync is never filled and hence the change has no effect.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h     |  1 -
 drivers/gpu/drm/amd/amdgpu/amdgpu_job.c | 18 ++++++------------
 2 files changed, 6 insertions(+), 13 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +0 -1
index 4f919d3..597109d 100644
@@ -1121,7 +1121,6 @@ struct amdgpu_job {
 	struct amdgpu_vm	*vm;
 	struct amdgpu_ring	*ring;
 	struct amdgpu_sync	sync;
-	struct amdgpu_sync	dep_sync;
 	struct amdgpu_sync	sched_sync;
 	struct amdgpu_ib	*ibs;
 	struct dma_fence	*fence; /* the hw fence */
drivers/gpu/drm/amd/amdgpu/amdgpu_job.c +6 -12
index 18770a8..90cde23 100644
@@ -60,7 +60,6 @@ int amdgpu_job_alloc(struct amdgpu_device *adev, unsigned num_ibs,
 	(*job)->num_ibs = num_ibs;
 
 	amdgpu_sync_create(&(*job)->sync);
-	amdgpu_sync_create(&(*job)->dep_sync);
 	amdgpu_sync_create(&(*job)->sched_sync);
 	(*job)->vram_lost_counter = atomic_read(&adev->vram_lost_counter);
 
@@ -104,7 +103,6 @@ static void amdgpu_job_free_cb(struct amd_sched_job *s_job)
 	amdgpu_ring_priority_put(job->ring, s_job->s_priority);
 	dma_fence_put(job->fence);
 	amdgpu_sync_free(&job->sync);
-	amdgpu_sync_free(&job->dep_sync);
 	amdgpu_sync_free(&job->sched_sync);
 	kfree(job);
 }
@@ -115,7 +113,6 @@ void amdgpu_job_free(struct amdgpu_job *job)
 
 	dma_fence_put(job->fence);
 	amdgpu_sync_free(&job->sync);
-	amdgpu_sync_free(&job->dep_sync);
 	amdgpu_sync_free(&job->sched_sync);
 	kfree(job);
 }
@@ -149,17 +146,9 @@ static struct dma_fence *amdgpu_job_dependency(struct amd_sched_job *sched_job,
 {
 	struct amdgpu_job *job = to_amdgpu_job(sched_job);
 	struct amdgpu_vm *vm = job->vm;
-
-	struct dma_fence *fence = amdgpu_sync_get_fence(&job->dep_sync);
 	int r;
+	struct dma_fence *fence = amdgpu_sync_get_fence(&job->sync);
 
-	if (amd_sched_dependency_optimized(fence, s_entity)) {
-		r = amdgpu_sync_fence(job->adev, &job->sched_sync, fence);
-		if (r)
-			DRM_ERROR("Error adding fence to sync (%d)\n", r);
-	}
-	if (!fence)
-		fence = amdgpu_sync_get_fence(&job->sync);
 	while (fence == NULL && vm && !job->vm_id) {
 		struct amdgpu_ring *ring = job->ring;
 
@@ -172,6 +161,11 @@ static struct dma_fence *amdgpu_job_dependency(struct amd_sched_job *sched_job,
 		fence = amdgpu_sync_get_fence(&job->sync);
 	}
 
+	if (amd_sched_dependency_optimized(fence, s_entity)) {
+		r = amdgpu_sync_fence(job->adev, &job->sched_sync, fence);
+		if (r)
+			DRM_ERROR("Error adding fence to sync (%d)\n", r);
+	}
 	return fence;
 }
 
Signature · 6 lines
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 1509731492-23454-1-git-send-email-Andrey.Grodzovsky-5C7GfCeVMHo@public.gmane.org

#2 lore raw

NAK, you will find the performance drop with this change.

dep_sync should be used by CS dependency/syncobj, I thought which already be handled.

I will make a patch for using dep_sync in a minute.

Thanks for reminder.

David Zhou

Quoted 74 lines · Andrey Grodzovsky

This reverts commit a340c7bcf1ea01f8bee82d62b521f0c5e4653425.

This is a cleanp of dep_sync in amdgpu_job. The origianl patch never calls amdgpu_sync_fence on dep_sync, only amdgpu_sync_get_fence in amdgpu_job_dependency, so dep_sync is never filled and hence the change has no effect.

---
  drivers/gpu/drm/amd/amdgpu/amdgpu.h     |  1 -
  drivers/gpu/drm/amd/amdgpu/amdgpu_job.c | 18 ++++++------------
  2 files changed, 6 insertions(+), 13 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +0 -1
index 4f919d3..597109d 100644
@@ -1121,7 +1121,6 @@ struct amdgpu_job {
  	struct amdgpu_vm	*vm;
  	struct amdgpu_ring	*ring;
  	struct amdgpu_sync	sync;
-	struct amdgpu_sync	dep_sync;
  	struct amdgpu_sync	sched_sync;
  	struct amdgpu_ib	*ibs;
  	struct dma_fence	*fence; /* the hw fence */
drivers/gpu/drm/amd/amdgpu/amdgpu_job.c +1 -12
index 18770a8..90cde23 100644
@@ -60,7 +60,6 @@ int amdgpu_job_alloc(struct amdgpu_device *adev, unsigned num_ibs,
  	(*job)->num_ibs = num_ibs;
 
  	amdgpu_sync_create(&(*job)->sync);
-	amdgpu_sync_create(&(*job)->dep_sync);
  	amdgpu_sync_create(&(*job)->sched_sync);
  	(*job)->vram_lost_counter = atomic_read(&adev->vram_lost_counter);
 
@@ -104,7 +103,6 @@ static void amdgpu_job_free_cb(struct amd_sched_job *s_job)
  	amdgpu_ring_priority_put(job->ring, s_job->s_priority);
  	dma_fence_put(job->fence);
  	amdgpu_sync_free(&job->sync);
-	amdgpu_sync_free(&job->dep_sync);
  	amdgpu_sync_free(&job->sched_sync);
  	kfree(job);
  }
@@ -115,7 +113,6 @@ void amdgpu_job_free(struct amdgpu_job *job)
 
  	dma_fence_put(job->fence);
  	amdgpu_sync_free(&job->sync);
-	amdgpu_sync_free(&job->dep_sync);
  	amdgpu_sync_free(&job->sched_sync);
  	kfree(job);
  }
@@ -149,17 +146,9 @@ static struct dma_fence *amdgpu_job_dependency(struct amd_sched_job *sched_job,
  {
  	struct amdgpu_job *job = to_amdgpu_job(sched_job);
  	struct amdgpu_vm *vm = job->vm;
-
-	struct dma_fence *fence = amdgpu_sync_get_fence(&job->dep_sync);
  	int r;
+	struct dma_fence *fence = amdgpu_sync_get_fence(&job->sync);
 
-	if (amd_sched_dependency_optimized(fence, s_entity)) {
-		r = amdgpu_sync_fence(job->adev, &job->sched_sync, fence);
-		if (r)
-			DRM_ERROR("Error adding fence to sync (%d)\n", r);
-	}
-	if (!fence)
-		fence = amdgpu_sync_get_fence(&job->sync);
  	while (fence == NULL && vm && !job->vm_id) {
  		struct amdgpu_ring *ring = job->ring;
 
@@ -172,6 +161,11 @@ static struct dma_fence *amdgpu_job_dependency(struct amd_sched_job *sched_job,
  		fence = amdgpu_sync_get_fence(&job->sync);

drivers/gpu/drm/amd/amdgpu/amdgpu_job.c static struct dma_fence *amdgpu_job_dependency(struct amd_sched_job *sched_job, · line 171

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_job.c +5 -0
  	}
 
+	if (amd_sched_dependency_optimized(fence, s_entity)) {
+		r = amdgpu_sync_fence(job->adev, &job->sched_sync, fence);
+		if (r)
+			DRM_ERROR("Error adding fence to sync (%d)\n", r);
+	}
  	return fence;
  }
 

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx